I found a tutorial about google maps using jquery. When I read the API documentation, they uses API_KEY, but the tutorial shows something like this
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script src="jquery.js"></script>
what is the difference? the documentation uses
"https://maps.googleapis.com/maps/api/js?key=API_KEY">
can someone explain me about this? I'm very new to maps by the way.
To create your API key:
Visit the Google Developers Console and log in with your Google Account.
Click the Services link from the left-hand menu.
Activate the Google Maps JavaScript API v3 service.
Click the API Access link from the left-hand menu. Your API key is available from the API Access page, in the Simple API Access section. Maps API applications use the Key for browser apps.
By default, a key can be used on any site. We strongly recommend that you restrict the use of your key to domains that you administer, to prevent use on unauthorized sites. You can specify which domains are allowed to use your API key by clicking the Edit allowed referrers... link for your key.
https://developers.google.com/maps/documentation/javascript/tutorial
Google Map Version 3 don't required the API Key. and this tutorial is based on Google map Version 3. And the Google Map Version 2 require the API key. for more detail check this...
http://googlegeodevelopers.blogspot.com/2010/03/introducing-new-google-geocoding-web.html
Related
In my drupal site i am getting the error alert like "This page can't load Google Maps correctly.". My website is built on drupal7. Where to add the script tag with that new API key generated through admin login UI. I mean in which module of UI i has to change. Please find the attached screenshot for reference.
Any quick help more helpful.
You need to get a license for google maps api as , Google has implemented a new Pricing module in july for google maps.
Google's new billing and pricing model requires you to add a credit card to use even the free API's. If you are using the Javascript API for Static Maps, it is no longer free. The documentation/tutorial page which shows code examples, will provide a key, however it will not work until you add your billing info.
https://cloud.google.com/maps-platform/pricing/sheet/
https://developers.google.com/maps/documentation/javascript/tutorial
I am trying to use Angular google maps and I went through the quick setup supplied by angular google maps
.config(['$routeProvider','$locationProvider','uiGmapGoogleMapApiProvider,
function($routeProvider,$locationProvider,uiGmapGoogleMapApiProvider) {
// Other configurations
uiGmapGoogleMapApiProvider.configure({
key: ‘MY_GOOGLE_API_KEY’,
v: ‘3.17’,
libraries: 'weather,geometry,visualization'
});
}
]);
I setup an API key in Google API Console, but when I load the page i get an MissingKeyMapError.
Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error
I have the Google Javascript API enabled in the API console. I am at a loss as to what I am doing wrong. Any help would be greatly appreciated.
I solved the issue. Turns out I was loading the Google Maps API v3 twice. I was loading it in the provider
uiGmapGoogleMapApi.then(function(maps) {});
and loading the script tag
<script src="https://maps.googleapis.com/maps/api/js"></script>
Once I removed the script tag, It worked!
Thanks for everyones help.
Make sure that you used a key parameter with a valid API key. Follow this link for the steps on how to get the proper API Key for your project.
Go to the Google API Console.
Create or select a project.
Click Continue to enable the API and any related services.
On the Credentials page, get a Browser key (and set the API Credentials). Note: If you have an existing Browser key, you may
use that key.
To prevent quota theft, secure your API key following these best practices.
(Optional) Enable billing. See Usage Limits
for more information.
But based from this thread, the problem was because of a stray script tag which was including the google maps api before using this library. You can also check this related SO question.
Hope this helps!
I have to use google map. I use below google API script
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY"></script>
And i got below Error
Google Maps API error: DeletedApiProjectMapError https://developers.google.com/maps/documentation/javascript/error-messages#deleted-api-project-map-error
I created a New Project & New API key. But still this error came. Kindly help to solve this error.
Yo should go to https://console.developers.google.com and after create your API KEY, go to "Google Maps JavaScript API" and just ENABLE (by default is DISABLE)
You need to enable Maps JavaScript API for your website.
API link: https://console.developers.google.com/apis/library/maps-backend.googleapis.com?q=map
Based from this documentation, the DeletedApiProjectMapError means that your API project may have been deleted from the Google API Console. Please check the project for which you generated the API key that's included in JavaScript API loader.
Since you have already created a new API project and get a new key on the Google API Console, one workaround I found on this forum is to try deactivating all plugins to see if one of them is causing a conflict.
Check this related link. It states that:
I created new API keys in the first project for those maps again and deleted second project. The maps work partially now - without markers. It looks a little like manual blocking by someone on the Google maps side. Maybe someone is blocking access to Marker Manager .js file somewhere between my computer and a server where it is stored to ban my website.
Hope this helps!
I activate/enable more API Google Maps on https://console.developers.google.com and disappear this error.
You have deleted the project in google cloud platform of which you created an API.Regenrate Api by creating a new Project in google cloud platform.
There some answers saying the JavaScript API needs to be enabled as it is disabled by default. That seems to have changed. It was enabled by default in my account. It did not work anyway. I had to disable and reenable the API, then it worked.
Also it is to be noted that Google says it may take a couple of minutes upon creation until the API key works, that may also have been the thing.
I'm using google maps to geolocate users on my website. After that I would need to find different services near them (I would like to have ability for webpage to input search term in google maps with geolocaion) Is this possible? and if it is how could I do it?
You can use following example for searching places.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&type=restaurant&name=cruise&key=YOUR-API-KEY-GOES-HERE
You have to create project in google console using below link
https://console.developers.google.com
Then create browser key and that key is which you have to use in above url which mention.
Last thing you need to enable Google Places API Web Service from https://console.developers.google.com
See below link for more detailed document.
https://developers.google.com/places/web-service/search#PlaceSearchRequests
Let me know if any issue you faced.
This question has been asked before and I read the solutions and none of them seem to work. I always get an error message that states -
"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"
I'm sticking to the code provided on the "Getting Started" tutorial, word for word. I've obtained the API key as they suggested and have even activated the Google Maps API V3 service. I still seem to be getting that error.
I doubt it's my code because I have literally copied and pasted the code they have provided (except have added my own API key in place), like so.
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key={My_Key_Instead}">
</script>
The link to the tutorial and the code I'm using is provided below.
https://developers.google.com/maps/documentation/javascript/tutorial
Edit - I would like to mention that I've allowed any referer.
The solutions I have tried mentioned in other posts are:
1 - Getting a new API key
2 - Allowing any referer - (Part of the API access settings in the Google APIs Console) These are websites I accept requests from.
3 - Ensuring that Google Maps API V3 service has been activated.
4 - Ensured that it is a key for browser apps.