We recently updated our google service to the premier service and as a result the syntax for calling into the page the API is different.
http://code.google.com/apis/maps/documentation/webservices/#BuildingURLs

 http://maps.googleapis.com/maps/api/staticmap?center=%E4%B8%8A%E6%B5%B7+%E4%B8%AD%E5%9C%8B&client=clientID&sensor=true_or_false

is now the proper syntax.. there is no longer a "key" parameter.

From Google about the key param:
"Including this parameter contravenes the API syntax... including this parameter will cause these requests to fail in the near future."

Unfortunately the Keys module doesn't let me actually change the name of the "key" parameter
I've found a way to remove the key from the query in the gmap.module core, but it seems hackish...

line: 326

    'key' => gmap_get_key(),

to line 326:

    'client' => gmap_get_key(),

and line 1112

  $data = drupal_http_request('http://maps.google.' . $tld . '/maps/geo?q=' . drupal_urlencode($address) . '&output=csv&key=' . $key);

to line 1112

  $data = drupal_http_request('http://maps.google.' . $tld . '/maps/geo?q=' . drupal_urlencode($address) . '&output=csv&client=' . $key);

Anybody else encountered this and come across a better fix? Is there some setting I'm missing here?

Technically I don't think you are even supposed to be geocoding and storing results per the terms of service agreement without a Google Maps Premier key, so why would it not be set up to support that?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tmsimont’s picture

Status: Active » Needs review
FileSize
3.94 KB

I made a patch that replaces the API key with a client ID, and adds a field for the super secret crypto key that then gets used to generate the signature parameter with a php base64 HMAC-SHA1 algorithm. it works for me, but wipes out the ability to use anything other than the premier client-id/signature set up.

Also I hard coded sensor=false -- which is bad and lazy but I didn't need it... maybe somebody can set that up in the settings_ui.inc and make this better..

I made a few other changes to the way the link gets written into the head -- why were BOTH check_url() and url() being used before?? Replacing query string delimiters (&) with %26amp%3B seems kinda silly to me....

podarok’s picture

Version: 6.x-1.1 » 7.x-1.x-dev
Status: Needs review » Needs work

all feature requests can be imported in 6.x version after committing em in major versions with backport afterwards
Can You make this ?

tmsimont’s picture

Unfortunately I've not longer got access to a premier account. I don't think I'll be able to work on this as I won't have an account to use for testing.

podarok’s picture

Status: Needs work » Closed (cannot reproduce)

If someone can reproduce a bug and post a patch against latest major dev version - please, feel free to open his issue

k_a_l’s picture

Version: 7.x-1.x-dev » 7.x-2.11
Status: Closed (cannot reproduce) » Needs review
FileSize
3.58 KB

I needed to add these parameters and figured I'd integrate these changes into the ui. Hopefully this is helpful or useful for someone.

Status: Needs review » Needs work
k_a_l’s picture

previous patch was based off my site structure.

k_a_l’s picture

Status: Needs work » Needs review

The last submitted patch, 1: gmap_premier.patch, failed testing.

sasstevens’s picture

Current patch omits filling the field with the existing saved data, but otherwise works well.

k_a_l’s picture

Patch now adds existing saved data to client and channel form fields.