def get_image_from_gps(coords: str) -> Result: """ Get a result object containing the link to an street view image in the vicinity of the specified lat and long coordinates use as results.download_links(".") change "." to another path not to download in cwd ex: res = get_image_from_gps("45.5307147,-73.6157818") res.download_links("~/Downloads") """ params = { "size": "512x512", "location": coords, "pitch": "10", "radius": "1000", "key": "ASK MIKE OR VICTOR", "source": "outdoor", "fov": "120", } api_list = gsv_helpers.api_list(params) results = gsv_api.results(api_list) return results
def get_image_from_gps_adresses(params): """ Get a result object containing the link to an street view image in the vicinity of the specified lat and long coordinates use as results.download_links(".") change "." to another path not to download in cwd ex: res = get_image_from_gps("45.5307147,-73.6157818") res.download_links("~/Downloads") """ api_list = gsv_helpers.api_list(params) results = gsv_api.results(api_list) return (results)
def fetch_street_view_image(address: str, geocoder_api_key: str, streetview_api_key: str) -> gsv_api.results: """Retrieve StreetView images for the address.""" geocoder = GoogleGeocoder(geocoder_api_key) result = geocoder.get(address)[0] params = { "size": "600x600", "location": result.formatted_address, "pitch": "0", "key": streetview_api_key, "source": "outdoor", "fov": "120", } api_list = gsv_helpers.api_list(params) results = gsv_api.results(api_list) return results
assess_file.write(str(j) + ', ' + str(i) + '\n') assess_file.close() # Define parameters for street view api params = [{ 'size': '640x640', # max 640x640 pixels 'location': location, 'fov': fov, 'pitch': pitch, 'radius': radius, 'source': source, 'key': key }] # Create a results object results = streetview.results(params) # Download bilder to directory 'downloads' results.download_links('icarustreetviewOUTPUT/temp') j_file = open('icarustreetviewOUTPUT/temp/metadata.json').read() metadata = json.loads(j_file)[0] status = metadata['status'] print('API response for status: status == {}'.format(status)) try: pano_id = metadata['pano_id'] if status == 'OK': print('metadata: OK') picturepath = 'icarustreetviewOUTPUT/temp/' + metadata['_file']
next(csv_reader) # skip the header for row in csv_reader: centroid_lat = str(row[1]) centroid_lon = str(row[2]) # the coord is saved as x 1e7 integer to preserve precision # to obtain the actual coord needs to divide by 1e7 location_str += centroid_lat[:-7] + '.' + centroid_lat[ -7:] + ',' + centroid_lon[:-7] + '.' + centroid_lon[-7:] + ';' print('...reading parameters...') params = { 'size': '512x512', # max 640x640 pixels 'location': location_str[:-1], #'heading': '0;30;60;90;120;150;180;210;240;270;300;330', # if don't specify heading it will face the coordinate point 'pitch': '10', 'key': gsv_api_key, 'source': 'outdoor' } # Create a results object street_view_list = gsvhelpers.api_list(params) print('...data querying from API...') results = gsvapi.results(street_view_list) # Download images to directory 'downloads' # results.preview() print('...saving images...') results.download_links(csv_filename[17:-4]) print('...saving metadata...') results.save_metadata('street_view_metadata.json')