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.

Comments

babbage’s picture

Title: Modules may require key for http://localhost » Google Maps location may demand key for http://localhost
Anonymous’s picture

Google does require a key for localhost.

See http://mapki.com/wiki/FAQs#Key_Issues (your own URL):

If you want to test interaction with a server script, you can use Apache (or some other web server) on your computer and connect to it with http://localhost/. You would then apply for a key to http://localhost/ and use it like any other page.

and http://code.google.com/apis/maps/faq.html#keysystem

If you are developing on localhost, you will need to register a key for http://localhost.

PS: There is no key required when using file: URLs (which is not the case here).

babbage’s picture

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.

Anonymous’s picture

Every API key is tied to a Google account. See http://code.google.com/apis/maps/signup.html

You must have a Google Account to get a Maps API key, and your API key will be connected to your Google Account.

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.

babbage’s picture

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...

computer_jin’s picture

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,

Anonymous’s picture

babbage’s picture

Title: Google Maps location may demand key for http://localhost » Need to replace Google Maps API key when deploying from http://localhost to live site
Category: task » feature
Status: Postponed (maintainer needs more info) » Postponed

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.

babbage’s picture

Status: Postponed » Fixed

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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

lassekt’s picture

I had the same problem on my local vhost setup. First I created an API Key using same dummy domain names, but apparently the domain has to be identical to the domain name of your site. Nevermind if its a temporary name, like mine http://drupal7.dev, just paste it in and you will get your working API Key.

vizaipenumaka’s picture

I am using Google Maps in my flex application however it runs good with http://localhost but its not running when localhost replaced to IP address(192.168.0.139).how can i get API Key for this.

jddeli’s picture

Version: 6.x-1.0-beta1 » 6.x-2.0
Assigned: babbage » jddeli
Category: feature » bug
Priority: Minor » Critical
Status: Closed (fixed) » Active

This is not working.
There is no google map api for free.

jddeli’s picture

I got tired and decided that nothing happens with the google maps api.
I will deal again when I have time.
Too bad it does not work.

anil_89’s picture

Really google not require api key at localhost host pass blank at localhost server ,

vako’s picture

Google doesn't require a key anymore, but this module needs it, how can we around it?