Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using Geopy. I get following error for the code.

I have using the same code as on https://code.google.com/p/geopy/wiki/ReverseGeocoding

from geopy import geocoders

g = geocoders.GeoNames()
(place, point) = g.geocode("Palo Alto, CA 94306")
print place
>> "Palo Alto, US 94306"
print point
>> (37.418008999999998, -122.127375)

(new_place,new_point) = g.reverse(point)
print new_place
>> 3998 Ventura Ct, Palo Alto, US 94306 
print new_point
>> (37.417850000000001, -122.12793000000001)

Works fine till print point. Error occurs with g.reverse(point)

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python27\lib\site-packages\geopy\geocoders\base.py", line 9, in reverse
    raise NotImplementedError
NotImplementedError

Any suggestions?

share|improve this question
1  
Hmmm, on OSX with version 0.95.1 of geopy in a virtualenv I get a NotImplementedError on g.reverse(point) as well. I'm thinking this maybe hasn't made it from dev to trunk yet? Might want to get with the geopy maintainer. –  Chad Cooper Apr 26 '13 at 14:08

2 Answers 2

Did you install the development branch, as it mentioned in the link you provided?

The reverse geocoding feature is currently in an experimental but stable development branch, which you can checkout here:

svn checkout http://geopy.googlecode.com/svn/branches/reverse-geocode geopy

cd geopy/ sudo

python setup.py install

You may have to delete your old geopy installation.

share|improve this answer

Reverse geocoding available on geopy 0.97. You can download and install new version of geopy from https://github.com/geopy/geopy or clone the git repository.

git clone https://github.com/geopy/geopy.git
cd geopy
sudo python setup.py install

If you want to download and install for windows, you can get a latest version from https://github.com/geopy/geopy/archive/release-0.97.zip

Unzip and

cd geopy-release-0.97
python setup.py install

To geolocate a query to an address and coordinates:

>>> from geopy.geocoders import GoogleV3
>>> geolocator = GoogleV3()
>>> address, (latitude, longitude) = geolocator.geocode("175 5th Avenue NYC")
>>> print(address, latitude, longitude)
175 5th Avenue, New York, NY 10010, USA 40.7410262 -73.9897806

To find the address corresponding to a set of coordinates:

>>> from geopy.geocoders import GoogleV3
>>> geolocator = GoogleV3()
>>> address, (latitude, longitude) = geolocator.reverse("40.752067, -73.977578")
>>> print(address, latitude, longitude)
77 East 42nd Street, New York, NY 10017, USA 40.7520802 -73.9775683

--
Answered at http://stackoverflow.com/a/20991832/2509803

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.