bshah
bshah

Reputation: 167

Geocoder.google returning None values in Python

I am trying to use the geocoder.google to find zipcodes from the lat, long values. It keeps returning None value.

INPUT

a = gc.google([33.573256, -111.906344], method='reverse')
print a.postal
print a.address

OUTPUT

None
None

Can someone also tell me an easier way for converting Lat/long to zipcodes in python (preferably) or R. I have a csv file with about 58,000 rows. I want to find associated zipcodes to all these Lat,Lon values

Upvotes: 2

Views: 3943

Answers (1)

steveb
steveb

Reputation: 5532

From the Geopy github link

https://github.com/geopy/geopy

I used one of the examples to come up with a possible solution for you

from geopy.geocoders import Nominatim
geolocator = Nominatim()
loc = geolocator.reverse("33.573256, -111.906344")
print(loc.address)

8006, East del Timbre Drive, Scottsdale, Maricopa County, Arizona, 85258, United States of America

This doesn't address the problem with the code you already have but it sounds like you are looking for any solution that works.

Upvotes: 3

Related Questions