Python 3 Script to Convert Location or Address to Latitude and Longitude Coordinates Using geopy Module Full Project For Beginners

 

 

pip install geopy

 

 

After installing this library you need to make an app.py file and copy paste the following code

 

 

app.py

 

 

# importing geopy library
from geopy.geocoders import Nominatim

# calling the Nominatim tool
loc = Nominatim(user_agent="GetLoc")

# entering the location name
getLoc = loc.geocode("Gosainganj Lucknow")

# printing address
print(getLoc.address)

# printing latitude and longitude
print("Latitude = ", getLoc.latitude, "\n")
print("Longitude = ", getLoc.longitude)

Leave a Reply