The function google_geocode_location() in geocoding/google.inc currently returns NULL if Google's geocoding server returns any type of error.
Error code 620 usually indicates that the user "has submitted too many [geocoding] requests in too short a period of time" (http://code.google.com/apis/maps/documentation/reference.html#GGeoStatus...). In my experience, the Google servers issue this code if they receive more than a few (1 to 5?) requests per second from a given site. It's easy for a popular site to exceed Google's velocity threshold, and even easier in the case of bulk import operations that invoke node_save(). Retrying the operation after a one second wait will usually succeed.
So this is a fairly common "soft" error that's easily rectified by retrying the operation. Unfortunately the functions that invoke google_geocode_location() (notably including node_save()) treat this as an unrecoverable condition and lat/long values of 0.0000 are stored in the Location node. This obviously causes problems for users and developers for which there's no recourse at this time.
I suggest adding a configuration parameter to the Location module's Geocoding options (admin/settings/location/geocoding), specifying the number of times to retry a 620 error, with an implied one-second sleep between tries. The default value for this retry parameter should be zero so as not to alter the behavior of existing installations. An upper limit of, say, 30 is probably also in order.
Note: Other Drupalers have alluded to this problem but not written it up explicitly. See: http://drupal.org/node/301275#comment-2153602 and http://drupal.org/node/317159#comment-2145356.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | geocoding-delay-697468-5.patch | 1.36 KB | joelstein |
Comments
Comment #1
sethcohn commented+1
Comment #2
havran commented+1
Comment #3
TimelessDomain commented7.x is giving me this error in my log "Google geocoding returned status code: 620." It is failing to geocode every time. (EDIT: switched to yahoo for geocoding since google was not working - yahoo works)
Comment #4
bryancasler commentedSame problem with D7
Comment #5
joelstein commentedThe following patch adds an option to configure how many milliseconds of delay should be injected in-between geocoding requests. 200ms seems to keep my site under the rate limits (no more than 5 requests per second). It defaults to 0 (no delay).
Comment #6
dmcgowen commentedWe added the patch to our site and is keeping us under the geocoding limits imposed by Google.
Comment #7
dmcgowen commentedoops, forgot to change status....
We added the patch to our site and is keeping us under the geocoding limits imposed by Google.
Comment #8
EvanDonovan commentedAfter this gets in to 7.x, I will try to backport to 6.x, if it hasn't already been. I've experienced this as well, especially on batch ops.
Comment #9
Macronomicus commented+1
Oh yea... that's exactly whats required for batch ops.
Cheers!
Comment #10
ankur commentedThanks for the patch.
Committed to the 7.x-3.x and 7.x-5.x branches.