I recently started playing around with Gmaps and I put my google maps api key in the settings page and saved but everytime I navigate to the page used to make a google map, i get the message that

The Google Maps API key used on this web site was registered for a different web site. You can generate a new key for this web site at http://code.google.com/apis/maps/.

Can someone help me figure out why?



keyone’s picture

I'm having the same problem. Anyone figure it out?

robbm’s picture

The key is domain / directory specific. So if you register "www.mysite.com/maps", the key won't work for "www.mysite.com" (top level), "site.com/maps" (no www), "www.mysite.com/othermaps", "www2.mysite.com/maps", or "www.myothersite.com/maps".

Your best bet it to register "mysite.com" then the key will work for "www.mysite.com", "www2.mysite.com", "www.mysite.com/maps", "www2.mysite.com/othermaps", etc.

keyone’s picture

The Gmaps key generator requires that you put in the http:// part. I have tried it with and without the www. But nothing is working! I have also tried installing the keys manager module. no luck there either.

Also, it seems odd that the input box is always blank, even after trying to submit a key. Makes me wonder if it's not saving anything to the database. See screenshot. http://i44.tinypic.com/335429u.jpg

bang, bang, bang

Here is result of my headbanging so far:

I tried hard coding the API key into line 280 of the gmap.module. That got rid of the error message, but gmapping does not work (I just see blank grey box, no map).

I tried using the sample code that GMap API key generator gave me and put that on my domain. That does work, at least I see a map. Works both with and without the www:
So, that tells me that there is nothing wrong with my actual key.

Going to do more banging now...stay tuned!

This is a useful tutorial, but has not solved my problem:

If I look at http://www.interstateeateries.com/map/node (which is not accessible to you) the source code shows the google api string with & instead of &. Maybe a filter problem???
Here is part of the string:
script src="http://maps.google.com/maps?file=api&v=2.115&key=ABQIAA...snip...

One last idea, then am calling it a day...I took the source code from the /map/node/ page, and fixed the & problem, then uploaded that as static html. Still just a plain grey box, no map. Here it is.

Maybe it's just plain grey because I don't have any mapping parameters defined anywhere yet. Tired now. Maybe the drupal elves will answer my question while I sleep...

I lied, I kept looking. Now I see that the sample code that Gmaps API key generator gave me also uses the & syntax. So, that's not it. I also notice that the Firefox error console shows
Error: d has no properties
Source File: http://maps.google.com/intl/en_us/mapfiles/115/maps2.api/main.js
Line: 553

Meaning that d was not passed to gmaps from my site. Hmmmm
Next step is to look at this clue:
jQuery.extend(Drupal.settings, { "basePath": "/", "gmap_markermanager": [ ] });
Maybe somewhere in Drupal is a setting for gmap_markermanager that isn't right. Okay, I'm really going to bed now.

I don't know if continually editing this post bumps my question up. That is not my intent. My intent is to save my thoughts for posterity :-)

One more note 2nite. I created a new content type which includes location stuff. I created a node of that type. Very cool. However, /map/node still shows up blank grey box,even tho I know one node does have some data for it to show. Error console still shows d has no data. That must be the ticket.

keyone’s picture

I got gmaps working in my site FINALLY!!!! Read above comment to see my headbanging steps. In short, here's what I did:

hard coded the API key into line 280 of the gmap.module, so that line now looks like this:


I also followed the steps in this tutorial...very helpful:

Then go to the Gmap settings at admin/settings/gmap
check all four boxes for baselayer settings. The terrain one is defaulted to not checked. Check it. See http://i44.tinypic.com/o6gv2w.jpg for screenshot.

Tip: To make the Gmap Node locations display to show the right part of the world you want for your content, go into the Gmaps Location settings at admin/settings/gmap_location, scroll down to Node settings and change the GMAP macro code that looks like this: [gmap |id=nodemap|center=35,-80|zoom=7|width=100%|height=400px] The center numbers are latitude and longitude. To get the lat, lon you need, go to Google maps. maps.google.com and zoom into the map how you like it. Then follow the instructions on this page:
I used the numbers from there, and dropped the decimal to get -35,-80 and that was close enough.

Phew, that was hard! But it is way cool!

computer_jin’s picture

Thanks for ur tips.problem solved for me .

Azhar uddin
Technical Lead
email : engr.azharuddin@gmail.com
skype : computer_jin

keebo’s picture

I'm receiving the error that the API key was registered for another site on most pages. The only pages I'm not receiving the error message on are the /admin... and the /map... pages. Set up my API key for http://georgianhills.us.

I'm getting the map to show up correctly on the GMap configuration page and the "Build a GMap Macro" page, so the API key is correct. I'm just getting the error that the key was registered for another site on basically all pages except in the paths including /admin... and /map...

Anyone have any thoughts or a solution?

keebo’s picture

I also had installed and enabled the GMapEZ module and it was placing a Google Maps API in the header of all pages.

tapan joshi’s picture

I need the solution of this. Plz tell us.. if u can.

computer_jin’s picture

I am also having issue before many days can any one help me how can i solve this or i will have to disable google map api because its giving me the error on my site "google map api used for this website registered for different website".

Any one is there who solved this already ???


Azhar uddin
Technical Lead
email : engr.azharuddin@gmail.com
skype : computer_jin

computer_jin’s picture

I am still have this same issue can any one tell me how to solve this issue ...........

Azhar uddin
Technical Lead
email : engr.azharuddin@gmail.com
skype : computer_jin

computer_jin’s picture

I have solved this issue.I just add api key in module than its working fine for my site..

Azhar uddin
Technical Lead
email : engr.azharuddin@gmail.com
skype : computer_jin

mikyatope’s picture

Hi everyone, I simply harcoded the key into gmaps.module

replace line 295 :
'key' => gmap_get_key(),

for this:
//'key' => gmap_get_key(),
'key' => '*hardcoded key*>',

MickC’s picture

Hi all,

I found a different approach which works - editing the googlemap_api_key record in the Variable table.

Having found the following article, I then looked at the Variable table and edited the API key.
When I first changed the key, it actually cleared the record, but then I could re-enter it in the UI.
Up until then the API error was disabling the save button so I couldn't change it.
So for me this worked. The article below also talks about multiple sites, and editing setting.php


mrackham’s picture

I'm not sure why but I added gmap to my site and the page theme on the gmap configuration page was being completely broken and a javascript box was displaying saying that the google maps api key was incorrect. Attempting to update the key did not fix it.

i followed the suggestion of editing line 180 in the module and that fixed the theming being broken. Then, once the page was loading correctly, I tried pasting the google key in to the correct place on the gmap page and hit save. The key was sent to the database so I re-edited my module file, returning it to the original state and now gmap is working fine. I wanted to leave the code alone to ensure upgrades are low-hassle.

I'm not sure why gmap was breaking the layout on my site and it wasn't accepting a valid google maps site key but I don't think it was theme specific (I also tried it in Marinelli and it broke there as well).

Anyway, it is working now.


nightlife2008’s picture

I advise you to have a look at: http://drupal.org/project/keys

It's a module dedicated to managing multiple API keys based on config or domainname... AND Gmap supports it ;-)


VeryCool78’s picture

To make it work you will need
1- the module keys
2- Edit the gmap.module function gmap_get_key().
I wrote a post here for more details:
Gmap support for Keys module (Gmap Api key and Multi domain The solution)


Exploratus’s picture

Used your steps and it worked perfectly.

VeryCool78’s picture

Happy to hear that, You are welcome.