Skip to content

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')
See also  How to create a loop in Python turtle?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.