Google Maps API v3 not working
Posted
by
user1496322
on Stack Overflow
See other posts from Stack Overflow
or by user1496322
Published on 2012-07-02T14:46:11Z
Indexed on
2012/07/02
15:15 UTC
Read the original article
Hit count: 254
google-maps
|google-maps-api-3
I've been banging my head on the wall after going through the documentation on this several times! I can't seem to get past the API error to get the map to appear on my site.
I am getting the following error message from the web page where I want the map to be displayed: ~~~~~~~~~~~ Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: https://developers.google.com/maps/documentation/javascript/tutorial#Obtaining_Key ~~~~~~~~~~~
I have (several times now) gone into my account and 1) enabled the Maps v3 API service. 2) Generated a new API key. and 3) added my allowed referrers to the key. (both www.domain.com and domain.com URLs)
I have the following added to the head of the web page:
< script src="http://maps.googleapis.com/maps/api/js?sensor=false&key=MY_API_KEY_HERE" type="text/JavaScript" language="JavaScript">
And... I have the following javascript function that executes when a link is clicked on the page:
alert("viewMap()");
var map = new GMap3(document.getElementById("map_canvas"));
var geocoder = new GClientGeocoder();
var address = "1600 Amphitheatre Parkway, Mountain View";
alert("Calling getLatLng ...");
geocoder.getLatLng(address, function(point) {
var latitude = point.y;
var longitude = point.x;
// do something with the lat lng
alert("Lat:"+latitude+" - Lng:"+longitude);
});
The initial 'viewMap' alert is displayed and then is followed by the 'Google has disbled use...' error message.
The error console is also showing 'GMap3 is not defined'.
Can anyone please assist with showing me the errors of my ways?!?!?
Thank you in advance for any help you can provide. -Dennis
© Stack Overflow or respective owner