I am calculating latitudes and longitudes from zip code.
I have installed geopy
pip install geopy
In my code:
from geopy.geocoders import GoogleV3
def get_lat_lng(zip_code):
lat, lng = False, False
geocoder = GoogleV3()
location = geocoder.geocode(query=str(zip_code))
if location:
print location
lat, lng = location.latitude, location.longitude
return lat, lng
When I call above method and I am giving zip code of Lahore,Pakistan which is 54000.
get_lat_lng(54000)
Out put of latitude and longitude is:
(46.975033, 31.994583)
Actual latitude and longitude of Lahore are
31.5546° N, 74.3572° E
And on print of location I got:
Mykolaiv, Mykolaivs'ka oblast, Ukraine, 54000
What can be issue ?