It either doesn't seem to be possible to get keys for the V2 API any more, or the form for doing it was broken at Google's end when I just tried it, so I ported the module over to the V3 API. It's a bit nicer to set up, as you don't need API keys any more. Will attach patch in a second.

This is just the work to make it happen for new installs - we'll need a bit more work for updates. (Unsetting the saved API key and translating locationmap_type from the old values to the new value springs to mind, but there might be more.) I figured it'd be best to do that once this patch is reviewed.

CommentFileSizeAuthor
#1 port-to-v3-api-1309766-1.patch12.62 KBrupertj
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rupertj’s picture

Attaching patch

BWPanda’s picture

Status: Needs review » Reviewed & tested by the community

Works for me! (installed brand new)

dropbydrop’s picture

Please commit it!
Thanks

epawel’s picture

Works for me too! The only thing I changed was static image - in locationmap.module, function locationmap_static_image_url, $image_url I added: center=X,Y and sensor=false. And now I can use the module on multilingual and multidomains site, thanks !

DeNelo’s picture

I'm sorry, I don't get it - has this been patched into dev or 1.1 (which is newer than dev??).
Anyhow, it still requires an API key, and whichever one I generate on Google does not do the trick.

DeNelo’s picture

OK I did the patch (and changed the default locationmap_type value in locationmap.module from G_NORMAL_MAP to ROADMAP) - and now it works nicely! :) Thanks!

LeisureLarry’s picture

Thanks rupertj. I've uploaded a patched version 1.1 to my git account:
https://github.com/LeisureLarry/Drupal7-Modules-Locationmap

It supports both V2 and V3 (just don't enter a key).

pio.fernandes’s picture

Thanks for sharing. You ppl are awesome!
But I have one issue: I always get 403 on the page with the block. So the map block is never viewed. How can I fix this? Changing the maps.google.com to a specific IP?

Danny Englander’s picture

In regard to #7 above, what is meant by:

It supports both V2 and V3 (just don't enter a key).

-- It's a required field to enter in a Key so I am confused by this. At any rate, the patched module did not work for me, I see the map located at /locationmap but not in the block on a node page, it's a broken image but it was all working fine before Google changed the API.

StaticBelow’s picture

I had the same problem. I eventually just got a V2 API key and now the map works once you go to the map page but I don't have an image in the block. Does anyone have any advice how to use the V3 version, especially after you've already installed an earlier version. It seems that uninstalling the module does remove the files from the directory.

chester_martin’s picture

I didn't see the image either, but looking in firebug revieleded the image inside the -tag. so I just set display: block on the in the css and the image did show up.

webmestre’s picture

Impossible NOT to setup a Gmap Key into the configuration form of the module.
Then, I get an error message from Gmap V2. :-(((

I finally had to give the Gmap V2 key and it works better. It means many problems for new websites without Gmap Key...

StaticBelow’s picture

@chester_martin
Thanks, that did it! Firebug actually showed the image tag as having display:block but I added that line to my CSS file for the theme I was using and it's working now.

Thanks mate.

citygirl333’s picture

I'm fairly new to using Drupal and am working on my first website. I've never put in a patch before. How do you do it? Can it be done the same way I copy link addresses and paste in modules? Do I need to download Drush? If anyone can steer me in the right direction, I'd really appreciate it because I have no idea how you implement Google API with this system.

krueschi’s picture

Maybe this could be helpful to someone:
To create a V3 API key log in to your google account and then go to the products section. In there you should find a link to the "Developer consoles". Under "developer resources" there is the "APIs console" (mostly the 2nd one). This link leads to the API Project where you may find "API access". There you can create a new API key even for google API version 3.

BrettSh’s picture

Category: feature » bug

I ran the patch, and found I had to also do a search and replace on 3 values.

'G_NORMAL_MAP' > 'google.maps.MapTypeId.ROADMAP'
'G_SATELLITE_MAP' > 'google.maps.MapTypeId.SATELLITE'
'G_HYBRID_MAP' > 'google.maps.MapTypeId.HYBRID'

Haven't learnt how to create patch yet, sorry.

Danny Englander’s picture

I've tried every conceviable combination of code / patches / new v.2 & v.3 api keys here but with no luck. All I needed was a one-off map for my contact page so I simply went to Google and customized a map using the "Customize and preview embedded map" link and then embedded it in a static block and assigned that to my contact page node. It gave me the same result as I would have had with this albiet not ideal. My site went live yesterday so I could no longer afford time to try to get this module working, I needed to please my client.

rupertj’s picture

Status: Reviewed & tested by the community » Closed (fixed)

I've made a 2.0 release of this module, which contains the V3 API patch, and some of the other fixes listed here (Thanks DeNelo and BrettSh).

epawel - I didn't add the changes you suggested, as I'm not too sure what they're for :) If you could raise an issue for them, that'd be helpful. Thanks!