Answers for "python get latitude and longitude from address"

0

how to get latitude and longitude from address in python

# install
pip install geopy
# import
from geopy.geocoders import Nominatim
# code
app = Nominatim(user_agent="test")
address = "First St SE, Washington, DC 20004, United States"
location = app.geocode(address).raw
location['lat'], location['lon']
>>> ('38.8716329', '-77.005766')
Posted by: Guest on August-09-2021
0

python nominatim get latitude from address

>>> from geopy.geocoders import Nominatim
>>> geolocator = Nominatim(user_agent="specify_your_app_name_here")
>>> location = geolocator.geocode("175 5th Avenue NYC")
>>> print(location.address)
Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, ...
>>> print((location.latitude, location.longitude))
(40.7410861, -73.9896297241625)
>>> print(location.raw)
{'place_id': '9167009604', 'type': 'attraction', ...}
Posted by: Guest on December-20-2020

Code answers related to "python get latitude and longitude from address"

Python Answers by Framework

Browse Popular Code Answers by Language