Find the location with specified latitude and longitude using Python
In this article, we are going to write a python script to find the address of a specified latitude and longitude using the geopy module. The geopy module makes it easier to locate the coordinates of addresses, cities, countries, landmarks, and zipcode.
Installation:
To install GeoPy module, run the following command in your terminal.
pip install geopy
Step-by-step Approach:
- Import the geopy module.
- Initialize Nominatim API to get location from the input string.
- Get location with geolocator.geocode() method.
Below is the program based on the above approach:
Python3
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent = "geoapiExercises" )
Latitude = "25.594095"
Longitude = "85.137566"
print ( "Latitude: " , Latitude)
print ( "Longitude: " , Longitude)
location = geolocator.geocode(Latitude + "," + Longitude)
print ( "\nLocation of the given Latitude and Longitude:" )
print (location)
|
Output:
Last Updated :
06 Aug, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...