Hello,
Following the Google Geocoding API v2 deprecation, it seems impossible to use geocoding in a location field, which means longitude and latitude won't be calculated when a node's location is updated. Here's the notice in the log :
Google geocoding returned status code: 610
It is caused by the XML response :
<?xml version="1.0" encoding="UTF-8" ?>
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
<Status>
<errorcode>610</errorcode>
<request>geocode</request>
</Status>
</Response></kml>
The status code 610 corresponds to a bad api key, but I double checked it, mine was working last week and works for everything but geocoding, I tried the same request on my side, with other api keys, but still receive status code 610.
Same API key with an API V3 request works fine, but the XML response is not compatible with the module.
I had a look at the location/geocoding/google.inc file, where the api http request is done : from line 112. There is no API V3 support.
So the API migration will have to be developed unless we find an alternative until 8 September 2013.
Could someone confirm the issue ?
Thanks in advance.
Comment | File | Size | Author |
---|---|---|---|
#50 | fix-geocoder-1940474.patch | 2.49 KB | pebosi |
#40 | gmapv3code610d6-1940474-40.patch | 3.4 KB | LeDucDuBleuet |
#38 | gmapv3code610d6-1940474-38.patch | 3.6 KB | LeDucDuBleuet |
#36 | gmapv3code610d6-1940474-36.patch | 3.01 KB | LeDucDuBleuet |
#32 | fixGoogle610ApiError-1940474-32.patch | 3.01 KB | geekmuse |
Comments
Comment #1
Azzar CreditAttribution: Azzar commentedI can confirm that the geocoding on the site I'm developing stopped working March 8th.
I have to launch the site tomorrow, so for now I managed to make it work with a quick'n'dirty hack in location/geocoding/google.inc
Comment #2
bfranco CreditAttribution: bfranco commentedI noticed this and tried to come up with a solution. As stated, V2 of the API is abandoned, so we need to use V3. It doesn't need drastic changes. I attached a patch, this is how it works over here. I also switched to using json, because parsing xml with regex is a bit silly imo. Don't shoot me if it's not perfect or solutions are posted elsewhere, I'm only a Drupal development intern. ;)
Comment #3
leban CreditAttribution: leban commentedWould you care to tell us about your hack? I need to it get back to working quick as well...
Comment #4
shashikant_chauhan CreditAttribution: shashikant_chauhan commentedI am also getting Google geocoding returned status code: 610
Comment #5
leban CreditAttribution: leban commentedTried the patch...
offending line looks like this:
From Drupal log I noticed the following return code from Google:
Comment #6
bfranco CreditAttribution: bfranco commentedSimple, the url needs to be http://maps.googleapis.com/maps/api/geocode/json (or http://maps.googleapis.com/maps/api/geocode/xml depending on what you want). I've thrown out the key of the query because it's not needed.
After doing
$http_reply = drupal_http_request($url);
I use the data like this:
The location now is an object with 2 members, 'lat' and 'lng' which are the geocoded coordinates, so the return for google_geocode_location() should be
array('lat' => $location->lat, 'lon' => $location->lng);
The status code appears to be a string like 'OK' instead of numerical error codes.
I also removed the comma's in the constructed string in _google_geocode_flatten(), it screws things up due to url encoding (over here at least).
I haven't fully tested it, but it seems to be working.
@ leban, that's probably because it's not returning a geocoded location, so the result is empty. The status code test should be performed before the line of code that's generating the error. It needs some error handling. The patch isn't a ready to go solution, it's just to show a way.
Comment #7
manoloka CreditAttribution: manoloka commentedI have an issue since Sunday the 10th of March that may be related to this.
I use a "search by postcode proximity" list, that order a list results by proximity, that stopped working on Sunday for any new postcode (meaning not used before) searched for.
I'm getting a location log entry - Google geocoding returned status code: 610
Any way to make this work?
Comment #8
wellsys_world CreditAttribution: wellsys_world commentedWe've applied the patch in #2 and following some testing pushed out to a production site.
Our users' new postcode searches (Views proximity exposed filter) are being added to the zipcodes table.
Seems to have fixed the issue!
Thanks @bfranco
Comment #9
integrateurxhtm CreditAttribution: integrateurxhtm commentedThe patch #2 worked for me,
To avoid errors of #5, you have to move the $location line under the status_code test.
You'll get something like that
Comment #10
manoloka CreditAttribution: manoloka commentedWill this patch work for drupal 6? will this be ported to drupal 6?
I'm not programmer but I'd be happy to chip something in to get this sorted for drupal 6 too.
Thanks
Comment #11
podaroklets test it )
Comment #12
podarok#9 can You create a full patch against latest dev?
Comment #14
mikavirt CreditAttribution: mikavirt commentedPatch of post #2 and comment #9 solved the issue for me, thank you!
Comment #15
leban CreditAttribution: leban commentedApplied patch of #2 but now I don't get 610 any more but...
Google geocoding returned status code: OVER_QUERY_LIMIT
Oddly its not same as 620, DOS. Any ideas?
Comment #16
podarok#1940654: Geocoding stopped working (D7) related
Comment #17
leban CreditAttribution: leban commented#2: location_geocode_v3.patch queued for re-testing.
Comment #19
podaroklooks like the patch #2 needs reroll against latest 7.x-3.x-dev
Comment #20
manoloka CreditAttribution: manoloka commentedI can confirm that patch of post #2 and comment #9 solved the issue for me ... and I'm on D6
thank you!
Comment #21
Jerenus CreditAttribution: Jerenus commentedHere is the patch. It works for me.
Comment #22
podarok#21 commited pushed to 7.x-3.x
will be tagged in next minor release update
Thanks!!!!
Comment #23
podarokhttp://drupal.org/node/1942736 tagged in alpha release
Comment #24
Jerenus CreditAttribution: Jerenus commentedGreat!
Comment #25
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedThank you all for your time, it is great to see the Drupal community at work!
While it is true that this patch works, I believe it needs more work.
In the committed patch, I don't see why we removed the line :
- $delay_trigger = TRUE;
If we remove it, the first few lines in google_geocode_location that introduce a delay between consecutive requests will not work and this is important as stated in the Google geocode option page :
To avoid a 620 error (denial of service) from Google, you can add a delay between geocoding requests. 200ms is recommended.
In v3, the returned status will not be 620 but they are still enforcing a request rate limit.
Also, I believe the parameter for the country 'gl' should be rename 'region' as per the v3 spec :
https://developers.google.com/maps/documentation/geocoding/
And if we specify the country in the 'region' parameter, I don't think we should include it again in the 'address' parameter in the function _google_geocode_flatten since it may lead to incorrect response. For example, if the country is Canada (CA) and I make a request with only the country in the location, it will return a location in California which is not what we wanted.
Also, I don't see why we dropped the commas in the 'address' parameter, while it may work without them, it is in the spec as outlined in the example for JSON output format :
http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheat...
Also, if we remove the key from the request why do we keep the code that gets it ?
This comment is way longer than I had expected but I believe it is important, thanks again for your time!
Comment #26
podarokcan You provide a follow-up patch for that?
Comment #27
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedSure, here it is!
I let the country in the address since someone might want the approximate lat/long for a country and if we only specify it with the region parameter and not in the address, we get a ZERO_RESULTS status instead of coordinates.
I also added the url in the watchdog entry for debugging purposes.
Comment #28
podarok##2 nice
Looks good
commited and pushed to 7.x-3.x
thanks!!!
Comment #29
Jerenus CreditAttribution: Jerenus commentedI felt a great harvest, thank you very much.
Comment #30
skulegirl CreditAttribution: skulegirl commentedA huge enormous THANK YOU to the amazing drupal community for geting a patch up for this so quickly. I discovered this issue this afternoon and was freaking out thinking I'd be up all night trying to fix it. You've given me the gift of sleep!
Comment #31
Lalith CreditAttribution: Lalith commentedThank you verymuch @Jerenus for your patch. I am working on D6 and I couldn't able to apply patch directly on the file which I am having, seems there is a version difference. But I managed to make changes to my file based on your patch and it rocked :)
The module which I am using was worked till recent dates but suddenly it stopped working. I want to understand why this happens? Can someone clarify this?
Comment #32
geekmuse CreditAttribution: geekmuse commentedI just wanted to confirm @manoloka's posting that the patch(es) he mentioned did indeed get this working again. I thought I'd provide a 6.x-3.x patch for anyone who wanted a simplified way to fix this on 6.x installs. I was hesitant to change the issue status since this is a 6.x patch and this thread is for the 7.x branch, but testing out on 6.x installs would definitely be helpful to verify that I did this correctly :)
Comment #33
podarokbot?
Comment #35
podarokpatch needs reroll
Comment #36
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedHere is the patch for d6 based on latest dev, it is the same as the one in comment #27.
It is introducing the delay trigger to avoid going over limit with the Google API same as D7.
This patch removes the accuracy filtering for now same as D7, maybe we could introduce it back later?
Enjoy!
Comment #38
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedThe last submitted patch failed because the result is not exactly the same with the v3 API.
It now returns 37.4218378, -122.0846263 instead of 37.421972, -122.084143
I rerolled the patch with the new expected results in LocationGoogleGeocoderTest->testUSA()
Comment #40
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedOups, sorry, the error is caused by the delay trigger feature so I removed it.
Here is the re-rolled patch, sorry about the multiple submissions, it should pass now!
Comment #41
LeDucDuBleuet CreditAttribution: LeDucDuBleuet commentedChanging the status for the bot...
Comment #42
podarok#41 looks good
commited pushed to 6.x-3.x
thanks!!!!
Comment #43
podarokhttp://drupal.org/node/1952436 tagged beta2 release
Comment #45
thomas@explose.lu CreditAttribution: thomas@explose.lu commentedJust wanted to say thanks a lot for the quick fix! it works great.
Comment #46
Sylvain_G CreditAttribution: Sylvain_G commented#40 works for me with some adaptations on 6.x-3.2
Comment #47
szy CreditAttribution: szy commentedIs everything all right with beta3?
The patch looks like applied to google.inc, but I still
get 'ZERO RESULTS' for addresses in Poland.
What about you, guys?
Szy.
Comment #48
ducdebreme CreditAttribution: ducdebreme commentedJust upgraded to location-6.x-3.x-dev and it fixed the problem.
I think, you should create a new release, which includes fix - the official release is unuseful.
Comment #49
pebosi CreditAttribution: pebosi commented#48 is right, geocoding is not working on 3.3, patch attaching...
Comment #50
pebosi CreditAttribution: pebosi commentedPatch removes "component" from api query, as it is not needed and query will show "ZERO _RESULTS". Also the api key settings form is removed, there is no need to add a key.
Comment #51
pebosi CreditAttribution: pebosi commentedComment #52
crystaldawn CreditAttribution: crystaldawn commentedCall me crazy but I dont see these patches in either the Stable OR dev branches for 7.x Where is the issue queue entry for the 7.x branch for this problem. The geocoding features are completely useless without these patches now that V2 has been completely depreciated and removed from existence. It's time to move on in the world :P. They work fine when I add them in by hand, but this shouldnt be necessary since they have been tested for some time now.
UPDATE: This was a drush issue. For whatever reason, no matter what I did, drush kept getting a version that did not have this issue fixed. I ended up having to DL/install it manually.
Comment #53
podarok#50 commited pushed to 6.x-3.x
Thanks!