Created
September 29, 2021 04:52
-
-
Save momota10s/ab90939a180499fff3e25061d4f8154a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
address = "東京都千代田区千代田" | |
api_key = "" | |
requestUrl = f'https://maps.googleapis.com/maps/api/geocode/json?address="{address}"&key={api_key}&sensor=false' | |
r = requests.get(requestUrl).json() | |
if(r['results'] == []): | |
print("non result") | |
lat = None | |
lng = None | |
else: | |
print(r['results'][0]['geometry']['location']) | |
lat = r['results'][0]['geometry']['location']['lat'] | |
lng = r['results'][0]['geometry']['location']['lng'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment