Python3 reverse geocoding with google maps
<p>When you run this code, it will fetch the geocoding results for the provided address and print the JSON representation of those results with proper indentation, making it easy to …
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import json
from pygeocoder import Geocoder
business_geocoder = Geocoder(api_key='my_google_api_key')
results = business_geocoder.geocode("address")
# Get a dictionary representation of the geocoding results
json_result = results.serialize()
# Convert the dictionary to a JSON string with indentation
json_string = json.dumps(json_result, indent=4)
# Print the JSON string
print(json_string)
|