I am trying to download all the building addresses on a specific street.
Is it possible to download all addresses using Google Maps API as building address are available online in maps but API is not showing all addresses.?
The attempt that I have made
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
# import the library
import googlemaps
import json
import pprint
import xlsxwriter
import time
import pandas
# Define the API Key.
API_KEY = 'AIzaSy---------------------------------'
# Define the Client
gmaps = googlemaps.Client(key = API_KEY)
#places_result = gmaps.places_nearby(location='-33.8670522,151.1957362', radius = 40000, open_now =False , type = 'Building')
places_result = gmaps.places_nearby(location='-38.339655,143.58063649963287', radius = 50000, open_now =False , type = 'cafe')
time.sleep(3)
place_result = gmaps.places_nearby(page_token = places_result['next_page_token'])
stored_results = []
# loop through each of the places in the results, and get the place details.
for place in places_result['results']:
# define the place id, needed to get place details. Formatted as a string.
my_place_id = place['place_id']
# define the fields you would liked return. Formatted as a list.
my_fields = ['name','place_id','geometry']
# make a request for the details.
places_details = gmaps.place(place_id= my_place_id , fields= my_fields)
# print the results of the details, returned as a dictionary.
pprint.pprint(places_details['result'])
# store the results in a list object.
stored_results.append(places_details['result'])
# -------------- DUMPING VALUES IN EXCEL -----------------------
# define the headers, that is just the key of each result dictionary.
row_headers = stored_results[0].keys()
#%%
#%%
# create a new workbook and a new worksheet.
workbook = xlsxwriter.Workbook(r'C:\Users\Ali\OneDrive - UNSW\Zepben_coding\Line_2020\'Google_Coordinates.xlsx')
worksheet = workbook.add_worksheet()
Is there any other way to collect all the addresses of buildings from a specific location?
After address I want to geocode into Lat/Long information.