2

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

2
  • FYI that is going to cost you $28 to use the google api for that many addresses. Commented Dec 30, 2015 at 23:34
  • @AndyW Can you direct me to an alternative solution? Commented Dec 31, 2015 at 18:46

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Does it limit me to only 'n' number of addresses per day? From @Andy's comment above I am assuming that all the geocoding libraries which might be using Google API will not let me query for 58000 addresses.
I don't know unfortunately. They probably have some guidelines on this on their webpage.
This example uses Nominatim - which is not google - so I don't know there usage rates. See gis.stackexchange.com/a/21390/751 for advice about batch geocoding. Census has zip code areas, it is a simple task in a desktop GIS program.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.