Giter Club home page Giter Club logo

google_streetview's Introduction

google_streetview

Richard Wen
[email protected]

A command line tool and module for Google Street View Image API.

pypi version Build Status Coverage Status Stars GitHub license Donarbox Donate PayPal Donate Twitter

Note: Google changed StreetView API pricing and a billing plan may be required (checked March 5, 2019).

Install

  1. Install Python
  2. Install google_streetview via pip
pip install google_streetview

For the latest developer version, see Developer Install.

Usage

For help in the console:

google_streetview -h

Ensure that a Google API developer key is set:

google_streetview -s key="your_dev_key"

Search street view for latitude and longitude 46.414382,10.013988:

google_streetview "46.414382,10.013988"

Save images to a directory:

google_streetview --location="46.414382,10.013988" --save_downloads=downloads

Obtain a 360 panorama by rotating the camera heading given a 90 degree field of vision fov::

google_streetview --location="46.414382,10.013988" --fov=90 --heading=0;90;180;270

Use as a Python module:

# Import google_streetview for the api module
import google_streetview.api

# Define parameters for street view api
params = [{
	'size': '600x300', # max 640x640 pixels
	'location': '46.414382,10.013988',
	'heading': '151.78',
	'pitch': '-0.76',
	'key': 'your_dev_key'
}]

# Create a results object
results = google_streetview.api.results(params)

# Download images to directory 'downloads'
results.download_links('downloads')

For more usage details, see the Documentation.

Contributions

  1. Reports for issues and suggestions can be made using the issue submission
  2. Code contributions are submitted via pull requests

See CONTRIBUTING.rst for more details.

Implementation

The package google_streetview uses the following components:

Component Purpose
Google Street View Image API API for Google Street View images
google_streetview.api Module for interfacing with Google Street View Image API using requests
requests Download and get URLs from Google Street View Image API
  
  Google Street View Image API     <-- API for Street View Images
               |
      google_streetview.api        <-- URL Request with query string
               |
            request                <-- Download URLs and images

For more information, see NOTES.rst.

google_streetview's People

Contributors

rrwen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

google_streetview's Issues

Include multiple arguments for heading, fov, and pitch

Include multiple arguments for Command Line Interface (CLI) to accept all combinations of heading, fov, and pitch.

For example:

google_streetview --location=46.414382,10.013988;46.414382,10.013988;40.720032,-73.988354 --heading=0;90;180;270 --fov=0;90;120 --pitch -90;0;90

Given 2 locations, 4 headings, 3 fovs, and 3 pitches, the number of images returned from all possible combinations is:

2 x 4 x 3 x 3 = 72 images

The multiple heading parameter is useful for creating panoramic imagery (with rotations from 0 to 270 degrees assuming a fov of 90).

One location with one heading

I have a lot of points with location and heading, how can I get the result that one location with one heading?

image

Thank you !

How to download 360 degree street view images?

Really appreciated your sharing with us.

I could only download one normal image, rather than 360 degree, pano image. Could you guide us how to download 360 degree images using the tool?

Thank you

Rename saved images

Hi,

Is it possible to specify the filename of the downloaded images when using results.download_links()?

Thank you

Pick-up Download Images at Request Time Out

Purpose

Hello, I'm using the api to download ~16k Google Street View photos and around photo 4500 the request timed out. How can I continue downloading from where the request timed out without having to reload the params, from the timed out point, onto the results again.

Example

params is ab 16k

results = google_streetview.api.results(params)
results.links[4176:].download_links('balt_streetview_downloads')

I want to pick up downloading photos from number 4176. The above doesn't work because results.links is a list and .download_links works on the results. object only.

Notes

No image displaying

Hello,

When I run the code:

params = [{
	'size': '600x300', 
	'location': '35.124762,-89.990795',
	'heading': '151.78',
	'pitch': '-0.76',
	'key': 'KEY NOT SHARED HERE'
}]

results = google_streetview.api.results(params)
results.preview()

It does not display an image. I am running this code in Google Colab. Here is what I get instead:

[0] DcLKdIVOjVWy1jDDui2kDA
===========================
date: 2019-06
location: 
  lat: 35.12474824026881
  lng: -89.99079815233901
pano_id: DcLKdIVOjVWy1jDDui2kDA
status: OK

How do I get the image from google street view to appear?

.

.

WPF Web Browser control and Google Streetview

Hi,

I have a WebBrowser control that I am displaying a Google Streetview url in. In a browser such as Chrome, when you navigate the Streetview scene by clicking on the map to move one way or the other, a new url is generated and the map moves. But with the WebBrowser control it does not seem to generate a new url. The map moves, but no new url gets returned. I am using the Navigating and Navigated events, but nothing shows up.

Any advice on how to get things working? I just need to get the url so I can parse out the x/y coordinate and do other things with it.

I've posted on MSDN, but they recommended I use this forum: https://docs.microsoft.com/en-us/answers/questions/953602/wpf-web-browser-control-and-google-streetview.html?childToView=962150#comment-962150

Thanks

Hi @TMorville

Hi @TMorville

Here is my code:

params = [{
	'size': '600x300', 
	'location': '35.124762, -89.990795',
	'heading': '151.78',
	'pitch': '-0.76',

}]

results = google_streetview.api.results(params)

results.preview(k=['date', 'status', 'location'], kheader = 'date')

I have set up billing and I am getting this error:

--------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-221-376f3fabd1d8> in <module>()
      9 results = google_streetview.api.results(params)
     10 
---> 11 results.preview(k=['date', 'status', 'location'], kheader = 'date')

/usr/local/lib/python3.6/dist-packages/google_streetview/api.py in preview(self, n, k, kheader)
    135 
    136       # (print_header) Print result header
--> 137       header = '\n[' + str(i) + '] ' + kv[kheader]
    138       print(header)
    139       print('=' * len(header))

KeyError: 'date

Getting multiple pictures in one request does not work (helpers.api_list)

Purpose

I want to use the API to send a request to Google static street view API that contains several different lat/long coordinates, bearings, etc.

Example

Running the example in the documentation:

# Import google_streetview for the api and helper module
import google_streetview.api
import google_streetview.helpers

# Create a dictionary with multiple parameters separated by ;
apiargs = {
  'location': '46.414382,10.013988;40.720032,-73.988354',
  'size': '640x300;640x640',
  'heading': '0;90;180;270',
  'fov': '0;90;120',
  'pitch': '-90;0;90'
}

# Get a list of all possible queries from multiple parameters
api_list = google_streetview.helpers.api_list(apiargs)

# Create a results object for all possible queries
results = google_streetview.api.results(api_list)

# Preview results
results.preview()

# Download images to directory 'downloads'
results.download_links('downloads')

# Save metadata
results.save_metadata('metadata.json')

Simply produces a error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-396-9db778c1cdf8> in <module>
     19 
     20 # Preview results
---> 21 results.preview()
     22 
     23 # Download images to directory 'downloads'

~/.anaconda3/envs/ox/lib/python3.7/site-packages/google_streetview/api.py in preview(self, n, k, kheader)
    135 
    136       # (print_header) Print result header
--> 137       header = '\n[' + str(i) + '] ' + kv[kheader]
    138       print(header)
    139       print('=' * len(header))

KeyError: 'pano_id'

Notes

The notes section provides any additional text that do not fit into the above sections.

Multiple locations not working with separator ";"

Hi,

I have installed the library and I can download single images. I am working on Ubuntu 16.04, and I installed google_streetview via pip. When I run the command

google_streetview --location=46.414382,10.013988;40.720032,-73.988354

I get my image in the 'downloads" folder. However, if I try with multiple locations:

google_streetview --location=46.414382,10.013988;40.720032,-73.988354

Then I get this error:

[0] vPnURflnc8AZu5NMLYRddw
"==========================="
date: 2014-04
location: 
  lat: 46.4143421009
  lng: 10.0140059536
pano_id: vPnURflnc8AZu5NMLYRddw
status: OK
40.720032,-73.988354: command not found

Whenever I add a second argument to --location (as in this example) or to --headings, the program reports the second argument as a separate command.

Any ideas how to fix this?

Thanks a lot

Cheers

How many locations at once?

Hi,
I have used the repo and it's great!

Could you tell me if there is an upper limit to the number of locations that can be sent at once to the API?
I entered 49 locations into the helpers.api apiargs dictionary but I only get 10 pano ids (0 to 9) in the command log.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.