开发者

GoogleMapsError 602: Can't reverse geocode on a lat/lng obtained by geocoding

I'm using the Python Google Maps wrapper (http://py-googlemaps.sourceforge.net/) and tryin开发者_开发问答g to get some driving directions. I've got a load of test locations in latitude/longitude pairs which I obtained by geocoding certain addresses on Google Maps. However when running my program I get Google Maps error 602 which I assume means that it can't find an address associated with that latitude and longitude. This is the function that is running when the error is thrown:

def GetDirections(loc1, loc2):
    origin = gmaps.latlng_to_address(loc1.lat, loc1.lng)
    destination = gmaps.latlng_to_address(loc2.lat, loc2.lng)
    return gmaps.directions(origin, destination)

This is the error I get:

File "allocationtesting.py", line 69, in GetDistance
 return GetDirections(loc1, loc2)['Directions']
File "allocationtesting.py", line 84, in GetDirections
 return gmaps.directions(origin, destination)
File "googlemaps.py", line 450, in directions
 raise GoogleMapsError(status_code, url=url, response=response)
googlemaps.GoogleMapsError: Error 602: G_GEO_UNKNOWN_ADDRESS

...so, strangely the addresses are being resolved (i.e. there was no error with the latlng_to_address() function) but error 602 is being thrown when finding directions between two locations. Both locations are in major cities in the UK so I can't see how that is the case. I've tried geocoding the test addresses again and it came up with the same latitude and longitude pair as I have in the test data. Does anyone know what could be wrong? I've never had this problem before.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜