Need to replace Google Maps API key when deploying from http://localhost to live site
dbabbage - February 16, 2009 - 04:25
| Project: | Google Maps location |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | feature request |
| Priority: | minor |
| Assigned: | dbabbage |
| Status: | closed |
Jump to:
Description
Google does not require a Google Maps API key for localhost. However, the Google Maps location module may be written to require this on all occasions in order to function. To be confirmed.

#1
#2
Google does require a key for localhost.
See http://mapki.com/wiki/FAQs#Key_Issues (your own URL):
and http://code.google.com/apis/maps/faq.html#keysystem
PS: There is no key required when using file: URLs (which is not the case here).
#3
Ah right, I was mislead by this and didn't read the other page properly obviously. And the localhost key is not always identical so I guess hardwiring it may not be ideal—but then since no other identifying information is provided at the point of getting the key, perhaps it doesn't matter if everyone was using the same localhost key. Hmm.
#4
Every API key is tied to a Google account. See http://code.google.com/apis/maps/signup.html
If the same key is being used for "localhost"s all over the planet, I guess Google will pull the plug on that Google account rather quickly. Sharing a Google Maps API key looks like a bad idea.
#5
Yes, I realised it was tied to the Google account after my last post, and after some tests. Since there is no limit to the number of maps queries made by any one key, I doubt Google would be concerned about a few different localhost requests being made with the same key—the usage numbers for this module are small anyway. However, I still don't intend handing out a key linked to my Google account...
#6
Hi,
I am having issue before many days can any one help me how can i solve this or how can i 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 ???
thanks,
#7
Just request an API key for http://localhost/ at http://code.google.com/apis/maps/signup.html
#8
Changed to more accurate title. Sensible feature at add at some point in the future to allow both a localhost and live site key to be stored, perhaps, but it won't be a high priority to add.
#9
In order to use a separate key for your localhost installation, just add the following code to your settings.php file for that installation:
$conf['gmaplocation_key'] = '...';Replace the ... with the Google Maps API key you've been issued for http://localhost and it will override that stored in the database for your live site. This enables you to migrate your database between live and dev sites without experiencing difficulties with the Google Maps API key.
This solves the originally requested feature problem, without cluttering the module interface with a localhost key option—which many people would not use as many development sites are not run at http://localhost. Therefore, this issue will now be closed.
#10
Automatically closed -- issue fixed for 2 weeks with no activity.