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 copy list item to another list in Java?

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.