using multiple Google Map Api Keys - javascript

Can I use more than one google maps API key in the same app?
I'd like to realize following two features on my app:
To load GoogleMap by using Google Maps Android API, and search routes by Google Maps JavaScript API.
To get multiple routes at high speed by using multiple Google Maps JavaScript API Keys. If one key, OVER_QUERY_LIMIT error will occur when DirectionsService.route() is called.
Does anyone know about this?

The limits for requested services by using the maps-Javascript-API apply to the user, not the the project.
So the usage of multiple keys wouldn't change any anything, because the user(IP of the client) is still the same.

Related

Google maps direction summary from API

Is it possible to get the following summary from the google direction service api:
There is a summary property returned by the API but it doesn't matcch the summaries on google. (see screen grab)
Google Maps App != Google Maps APIs and Service
Just to set the correct expectations, you shouldn't expect the Google Maps APIs and Web Services and the Google Maps App to work in the exact same way at all times.
The Google Maps App gathers data from many different sources, such as Wikis, local business listings or Google+ information. The Directions API on the other hand uses a mix of information from the Geocoding API with other APIs to determine the best path to a given location.
What now?
In short, you can't expect these two different things to return the same, and the Directions API is not equipped to return all the data you are looking for.
You can however try the following:
Make multiple requests (as you pointed) and use the optional alternatives parameter;
Mix you data with data from third parties, like Google does.
Hope it helps !

Google Maps Javascript API Usage not showing

I recently (like 4 hours ago) added an api key and enabled billing for Google Cloud Platform so my Google Maps Javascript API wouldn't get blocked at 25,000 places autocomplete requests. I expected to see usage statistics in Google Cloud Platform immediately but still it shows zero usage activity. Am I doing something wrong?
I think you are checking the wrong API.
Try going to Google Places API Web Service : Key features include autocomplete, search, place picker, photos and add place
OR
Google Maps JavaScript API: build and style a map onto your website.
Check the usage statistic of these two API to see the request related to place autocomplete. Hope this helps

getting error using google maps api : This API project is not authorized to use this API

The google maps request is going to the Google Maps Api (javascript).
But I am getting this error message
And yes the google maps api is enabled and I have generated a key that I am using in my code.
But getting this error "This API project is not authorized to use this API", screenshot below
According to the recent changes announced on June 22, 2016
We now count Google Maps JavaScript API client-side requests towards the daily limit of the associated web service API.*
http://googlegeodevelopers.blogspot.com.es/2016/06/building-for-scale-updates-to-google.html
That means you have to enable Geocoding API in your project if you use geocoding service of Maps JavaScript API. If you use places library, you have to enable Places API and so on.
I am having this problem as well, but only on some pages within my site - on other pages, it works fine. All the pages which use the maps API use it in exactly the same way, via a shared javascript library.
I compared the network calls on pages with and without the error, and they appear to be 100% identical except for the Referrer URL (https://site.url/page/that/works vs. https://site.url/page/that/fails).
I have https://site.url in the "Accept requests from these HTTP referrers" list, and this functionality used to work on all the pages! It stopped working recently, perhaps as recently as this weekend, yesterday, or today.
Are you appending the maps script by hand on your website, or using a plugin? Can you send here your website URL?
Anyway, here it is how to append the API key:
Let's assume that you have the following piece of code
<script async defer src="//maps.googleapis.com/maps/api/js" type="text/javascript"></script>
To append the apy key, you must add ?key=YOUR_API_KEY at the end of the src path, like this:
<script async defer src="//maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>
If, instead, your src path already has some appended parameters (for example, "//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"), just add &key=YOUR_API_KEY at the very end:
"//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&key=YOUR_API_KEY"
This is how you append the API parameter (obviously, replace YOUR_API_KEY with your API key code).
You can find more information on obtaining a google maps key at https://developers.google.com/maps/documentation/javascript/get-api-key
Your API key should be up and running within 5 minutes. Enjoy!
To make it work
we need to use Google Maps Geocoding Api and Google Maps Javascript Api
I was unfortunately using only the javascript one.
It's working fine now.

How to detect that the 25000 request per day limit has been reached in Google Maps?

I'm working on a website using the Google Maps Javascript API v3.
The free version of the API is limited by 25000 requests a day. But what happens if this limit is reached?
Is there a way to detect that the request limit has been reached so a fallback Google Maps Image API map can be displayed instead?
The usage limit is based on site or application, not the client IP address.
You can use the Google API console to monitor your usage if you add an API key to each of your map requests. I have not seen a way to query the usage programmatically.
https://code.google.com/apis/console
Per the comment below by #alds, it does appear that JS Maps API v3 and Static Maps API are separate services, therefore having separate request limits. Falling back to a static Google map image could help.
This also explains the usage limits in better detail:
http://googlegeodevelopers.blogspot.com/2011/11/understanding-how-maps-api-usage-limits.html
You cannot detect via the API that the request limit has been reached. There are no events that are fired and the API does not expose a function or property to determine that the API quota has been reached.
Google has decided that this is not a feature they will implement.
https://issuetracker.google.com/issues/35830575#comment12
#kilogauss I would disagree that falling back to static Google Map is not an option.
According to https://developers.google.com/maps/faq#usagelimits
"Web sites and applications using the Google Maps API may at no cost generate up to 25,000 map loads per day FOR EACH service" (capitalization and boldface mine).
And on https://developers.google.com/maps/faq#usage_pricing, you can see that JS Maps API v3 and Static Maps API are separate services.

Will I be able to embed google maps on a website that has markers without the API key?

Will I be able to embed google maps on a website that has markers without the API key?
thanks
No, but if your website is openly accessible, you can get the API key for free. Note that this includes having different levels of access for different people.
Exception: You can embed all you want on localhost, to facilitate development.
The latest version of the Google Maps API doesn't require API keys.
Try using http://www.map-generator.net/
They use google maps...and put in a marker for you. Easy to use

Categories