Geocoding non-addresses: Geopy
- by Phil Donovan
Using geopy to geocode alcohol outlets in NZ.
The problem I have is that some places do not have street addresses but are places in Google Maps. For example, plugging:
Furneaux Lodge, Endeavour Inlet, Queen Charlotte Sound, Marlborough 7250
into Google Maps via the browser GUI gives me
However, using that in Geopy I get a GQueryError saying this geographic location does not exist.
Here is the code for geocoding:
def GeoCode(address):
g=geocoders.Google(domain="maps.google.co.nz")
geoloc = g.geocode(address, exactly_one=False)
place, (lat, lng) = geoloc[0]
GeoOut = []
GeoOut.extend([place, lat, lng])
return GeoOut
GeoCode("Furneaux Lodge, Endeavour Inlet, Queen Charlotte Sound, Marlboroguh 7250")
Meanwhile, I notice that "Eiffel Tower" works fine. Is there away to solve this and can someone explain the difference between The Eiffel Tower and Furneaux Lodge within Google 'locations'?