Google Maps API Keys are backTo embed Google Maps in a website, webmasters had to register for a free 'API Key' on the Google developers website. Then, Google changed the rules and for a while you could embed maps without a key. Now, from June 2016, API keys are back.
To get keys for your domains that use a Google maps module (you need one for each domain AFAIK) go to:
https://console.developers.google.comLog in with your Google account credentials. In the API Manager screen - to the right of the Google API logo - you will see a drop-down menu of API projects. If you had registered a key sometime in the distant past, you may find that you already have a project called 'API Project' which is the name given to legacy keys.
Getting a new keyGetting a new key is a two step process. First, you need to create a new project/key combination. To do this, select the aforementioned drop-down menu, choose 'Create Project' then follow the prompts. At some point a window will appear with the key which you can copy. You will need to paste it into a module preference field, or hard-code it into the URL that calls Google Maps.
Step two is to register your site domain with Google. To do this:
* Ensure the correct project is selected in the drop-down menu.
* Select the 'Credentials' option in the left sidebar.
* Click once on the key (the default name is 'Browser key').
* Under the section 'Accept requests from these HTTP referers' do the following:
1) In the empty field, enter the word
Quote:
and press 'Save' (this enables localhost map development)
2) In the new empty field that then appears, enter the actual site URL including the wildcards, e.g.
Quote:
It can take a few minutes for the changes to take effect.
Code changesThere have also been some changes to the way Google maps is accessed. Most importantly, you will need to change the primary script source URL from:
Quote:
to:
Quote:
//maps.googleapis.com/maps/api/js?key=.....
Some of the syntax has also changed, e.g.
Quote:
GMap2 changes to google.maps.Map
Quote:
GLatLng changes to google.maps.LatLng
There are more replacement pairs listed on the Google developers website, but these seem to be the significant ones. You may also need to remove some references to deprecated classes to prevent Javascript console errors. Running Firebug in Firefox will display errors from Google if their map API is unhappy about something.
For example, the addControl() method is deprecated, so in the module that I use I had to comment out:
Quote:
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
The default map controls are now enabled by default, so map navigation wasn't affected.
There's a good guide to implementing the update at:
https://developers.google.com/maps/articles/v2tov3HTH
*/