GET GEOLOCATION USING PYTHON
Source Code:-
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 | # Required Module:- pip install geopy# importing geopy libraryfrom geopy.geocoders import Nominatim# calling the Nominatim toolloc = Nominatim(user_agent="GetLoc")# entering the location namegetLoc = loc.geocode("Uttar Pradesh")# printing addressprint(getLoc.address)# printing latitude and longitudeprint("Latitude = ", getLoc.latitude)print("Longitude = ", getLoc.longitude) |
# Required Module:- pip install geopy
# importing geopy library
from geopy.geocoders import Nominatim
# calling the Nominatim tool
loc = Nominatim(user_agent="GetLoc")
# entering the location name
getLoc = loc.geocode("Uttar Pradesh")
# printing address
print(getLoc.address)
# printing latitude and longitude
print("Latitude = ", getLoc.latitude)
print("Longitude = ", getLoc.longitude)
0 Comments