In May, Google released the new Maps API, v3. This did away with API keys. I've updated geocode/google.inc and removed any reference to an API key. Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YesCT’s picture

Status: Patch (to be ported) » Postponed (maintainer needs more info)

Please check to see if this is still a problem in the new release. If it is, reply with a new summary and set the status to "needs work" as the patch will probably need to be re-rolled to apply to the new release.

jcarnett’s picture

Title: Google Maps API Key Still Required Even Though Google Doesn't Require One » Google Maps API v3
Version: 6.x-3.1-rc1 » 6.x-3.1
Category: bug » feature
Status: Postponed (maintainer needs more info) » Needs work
FileSize
6.22 KB
6.78 KB

While the patch may strip out the API keys, it still uses the v2 geocoder. Switching to the new API is a slightly more significant change, but it's definitely something that should be done at some point, especially with the v2 API being deprecated.

I've attached two patches against 6.x-3.1, one using the XML API and preg_match similar to the current implementation, and another using the JSON API and json_decode for PHP 5.2 folks. JSON should definitely be favored moving into Drupal 7.

The v3 API is incompatible with #503468: Make Google geocoding minimum accuracy a variable. The "accuracy" value was removed from the API, probably because its usefulness was debatable. Instead there is now a "partial_match" flag and "types" values you can use to more meaningfully determine whether the response is accurate. This patch does check for and exclude partial matches, meaning the address could not be fully understood by the geocoder.

cindyr’s picture

I just updated to Location 6.x-3.1, then installed your patch. It's still giving me the error when I have the coordinates enabled. The "This web site needs a different Google Maps API key. A new key can be generated at http://code.google.com/apis/maps/." error does not show on Content creation/edit if I disable that part.

It seems to work, but I haven't tested it extensively yet.

jcarnett’s picture

That sounds like the location picker feature provided by integration with the GMap module, which is still using version 2 of the javascript API. The open issue to update GMap is #818638: Update to use Google maps API V3, but there doesn't appear to be any progress. Until then you'll still have to provide an API key in the GMap module settings. This patch only updates the location module to use the v3 API.

cindyr’s picture

Thanks.

jcarnett’s picture

Updated patches. Changes:

  • Fixed a bug in the XML version -- "lng" => "lon" for the longitude key name.
  • Partial matches are no longer excluded, but instead cause the result to be stored as an approximate match rather than exact. This makes more sense to me because the fallback is a zip lookup in the database, which is most likely less accurate than a partial match from Google.
YesCT’s picture

Issue tags: +location bdragon check

This sounds interesting, can someone explain in simple terms what effect this change will have on a regular user getting started with location. Sounds like it might make things simpler for them.

If someone reviews it, we can mark it RTBC once it is ready and get a committer to look at it. :)

simon.fryer’s picture

Was anything further done on this to modify Location geocode to use V3 API?

SocialNicheGuru’s picture

6.x-3.x-dev tar.gz (1.63 MB) | zip (1.79 MB) 2011-Dec-21

json patch was fine.

errors when applying patch:

git apply location.geocoder_v3_xml_2.patch
error: patch failed: location.module:1317
error: location.module: patch does not apply
error: patch failed: location.admin.inc:158
error: location.admin.inc: patch does not apply
error: patch failed: geocoding/google.inc:101
error: geocoding/google.inc: patch does not appl

IreneKraus’s picture

This seems to be the issue dealing with my problem in that I've recently added Location into some existing sites to replace other modules (now unsupported) to collect user location info, etc. I was rather excited to discover this module as it seemed not only well supported but to provide more options. Namely, there will finally be a user location integration into Google's map. I cannot complete this at this time, however, as I can no longer obtain a Google Map API.

I would like to ask a question, which is, is there any way to move those data fields in the Profile to a separate tab? With it showing up under the Account section, I have to know someone's password to alter their record for them. It is not clear if they will be asked to provide that data upon their next log-in either, which would be an acceptable alternative. (Items set as required.)

Looking forward to some progress on this, and thanks for any suggestions someone may have!

Marino Katalinic’s picture

Hey Guys
this module is awesome and I appreciate the contributors efforts but one thing still remains an issue and unfortunately it impacts on many useful features of this module: Google Maps API v3 compatibility as at this time it seems impossible to auto generate longitude and latitude fields which I primarily to use in meta location...... Its being said that Google doesn't pay too much attention to this meta tag however seeing that search results are now being "tailored" by users IP location as well I suspect that meta tag may in fact be very, very important, if not right now then in the near future.

So I am voting for Google Maps API v3 comparability and invite everyone else needing this feature to vote
+1

Marino Katalinic’s picture

Could you provide any additional info on how this patch is applied? Also in post #9 a user is mentioning there are errors when attempting to apply this patch....are these errors still showing or this was a unique user experience?

Matze3000’s picture

The patch is useful right not since Google deactivated support for Geocoding API V2 last Friday (see note at the top of https://developers.google.com/maps/documentation/geocoding/v2/). Some requests are still processed correct from Google as far as I can see but it seemes that its time to switch to V3 API right now.

designate’s picture

Patch applies to 6.x-3.1 I assume? After applying patches does geocoding work again using V3 API?

podarok’s picture

Version: 6.x-3.1 » 6.x-3.x-dev
Status: Needs work » Needs review
Issue tags: -location bdragon check

bot?

Status: Needs review » Needs work

The last submitted patch, location.geocoder_v3_json_2.patch, failed testing.

podarok’s picture

patch needs reroll against latest dev

littleneo’s picture

podarok’s picture

Status: Needs work » Closed (duplicate)