Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrape google street view images of multiple location

I wanted to download google street view images through code , i actually did but i am facing some problems. I want to download single street view image with 180 degree camera of multiple locations.

I am using pypi's google-streetview 1.2.4 library in python for this. the code is below. https://pypi.org/project/google-streetview/ https://rrwen.github.io/google_streetview/#

# 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': '23.87,90.3939;23.87,90.3944;23.87,90.3951;23.87,90.3959',
  'size': '640x300',
  'heading': '0;90;180',

  'pitch': '0;0;0;0',
  'key': 'google_dev_key'
}

# 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('drive/colab/street_view/')

When i am using "heading" a single value like 180 or 90 it's showing pano_id keyerror.

but if i use heading = '0;90;180' then it is downloading 12 images of same locations. it's downloading repeatedly one image 3 times. as there are 4 locations 4 * 3 total 12 street view images i got but i want to download only 4 of 4 locations. how can i do it ?

like image 798
Mitu Vinci Avatar asked Nov 07 '22 05:11

Mitu Vinci


1 Answers

Just change 'pitch': '0;0;0;0' to 'pitch': '0', it tries to download images from 4 pitches, and they are all the same.

like image 188
Edgar Avatar answered Nov 14 '22 23:11

Edgar