Deprecation of V2 - google-maps

I have an application calling the v2 api without key using:
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key="></script>
This has stopped working over the past couple of days. Console is showing only one error:
Control is no longer supported in the Google Maps Javascript API v2...
However, whichever way I try and call the v3 API, I get an error :
"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 have checked, and re-connected a valid bank card to the account (although the outstanding balance was $0.00) This payment appears not to have been registered.
Any leaders on where to go next?

Don't use the Google Maps Javascript API v2, it is deprecated and has been turned off, replaced with a simple wrapper for the Google Maps Javascript API v3
From the error you report in the console, the functionality you are attempting to use is not available in the wrapper.
Port your code to v3 ASAP.

See https://developers.google.com/maps/documentation/javascript/v2/v2tov3#overview
You need to register a new API key.

Loading the Google Maps API page states to use this code with a new API key placed into the code at API_KEY and you will probably need to set your sensor to FALSE, also you may need to place the new API key into your application settings page.
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=API_KEY&sensor=FALSE">
</script>

Related

a commercial API key did not work: This page can't load google maps correctly

I used a new key and got:
"This page can't load google maps correctly"
What does it really mean?
<script src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY&libraries=places" async defer"></script>
This is a key from a commercial account.
For anyone who runs into this "This page can't load google maps correctly" error and has added the Places library in the JavaScript API script, i.e.:
<script src="https://maps.googleapis.com/maps/api/js?key=KEY&libraries=places"></script>
You must enable the Places API. It's not enough to enable the JavaScript API only. Refer to Google's documentation:
Before using the Places library in the Maps JavaScript API, first
ensure that the Places API is enabled in the Google Cloud Platform
Console, in the same project you set up for the Maps JavaScript API.
Hope this helps.

Google API Key for Google Maps in ZK Application from domain name

I have a ZK (Java Spring) application using Google Maps (gmaps). The version of ZK I am using is 7.0.3 EE.
In my application I didn't use a google API key, and since some time ago things seemed to work fine (I could correctly visualize the map).
It seems that since last july the use of an API key has become necessary, so I am trying to insert an API key.
So, I created a Browser API Key for my application, following the instruction at this https://support.google.com/cloud/answer/6158862?hl=en&ref_topic=6262490. Then, following the example at https://www.zkoss.org/zkdemo/reporting/google_map I added the following tag in my .zul page:
<script type="text/javascript" content="zk.googleAPIkey='my api key'" />
<gmaps ...>
</gmaps>
Note that if I access the web application from a local IP the map is correctly shown. If, on the other hand I access it through a registered domain name portal.mydomain.eu instead of the map I see a gray box with the following error message (note that in "Accept requests from these HTTP referrers (web sites)" I inserted my domain name as "*.mydomain.eu/"):
Oops! Something went wrong.
This page didn't load Google Maps correctly. See the JavaScript console for technical details.
The following are the Javascript console error messages (the messages are in Italian, I've inserted the english translation below each line where relevant):
GET
http://portal.mydomain.eu/images/portal_footer.jpg [HTTP/1.1 404 Not Found 23ms]
L’API Fullscreen con prefisso è deprecata, al suo posto utilizzare l’API senza prefisso. Per ulteriori informazioni consultare https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API controls.js:23:54
***the Fullscreen API with prefix is deprecate, use insteass the API without a prefix. For further information ... ***
"Google Maps API error: MissingKeyMapError https://developers.google.com/maps/documentation/javascript/error-messages#missing-key-map-error" js:35:350
"Google Maps API warning: NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys" util.js:221:12
"Google Maps API warning: RetiredVersion https://developers.google.com/maps/documentation/javascript/error-messages#retired-version" util.js:221:12
"Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required" util.js:221:12
"Google Maps API warning: InvalidClientId https://developers.google.com/maps/documentation/javascript/error-messages#invalid-client-id" util.js:221:12
L’utilizzo di getPreventDefault() è deprecato. Al suo posto utilizzare defaultPrevented.
***the usage of getPreventDefault() is deprecated. Use instead defaultPrevented.***
Any idea on what can I be doing wrong? Is it ok to have a "Browser Key" or do I need a different type of key?
edit:
I tried to replace the script tag with the one found at the link Whats the API Key for in Google Maps API V3?
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY" type="text/javascript"></script>
With this I see a white box instead of the gray one, and on the javascript console the error is now Google Maps API error: RefererNotAllowedMapError
Your answer to the updated question can be found on the documentation. Basically, RefererNotAllowedMapError indicates that the URL loading the API is not added to the list of referrers.
The current URL loading the Google Maps JavaScript API has not been added to the list of allowed referrers. Please check the referrer settings of your API key on the Google API Console.
See API keys in the Google API Console. For more information, see Best practices for securely using API keys.
There is a new version of gmaps just released
Try this version : 3.0.4.
https://www.zkoss.org/download/zkgmaps
You can try this code :
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"/> <gmaps>....</gmaps>
Also you have to upgrade your API from v2 to v3. Because Google Map up to Version 2 required API Key.
Get more details on this link.

ERROR: Google Maps API error: MissingKeyMapError

The following JavaScript error suddenly appeared:
Google Maps API error: Google Maps API error: MissingKeyMapError
Yes. Now Google wants an API key to authenticate users to access their APIs`.
You can get the API key from the following link. Go through the link and you need to enter a project and so on. But it is easy. Hassle free.
https://developers.google.com/maps/documentation/javascript/get-api-key
Once you get the API key change the previous
<script src="https://maps.googleapis.com/maps/api/js"></script>
to
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=your_api_key_here"></script>
Now your google map is in action. In case if you are wondering to get the longitude and latitude to input to Maps. Just pin the location you want and check the URL of the browser. You can see longitude and latitude values there. Just copy those values and paste it as follows.
new google.maps.LatLng(longitude ,latitude )
As per Google recent announcement, usage of the Google Maps APIs now requires a key. If you are using the Google Maps API on localhost or your domain was not active prior to June 22nd, 2016, it will require a key going forward. Please see the Google Maps APIs documentation to get a key and add it to your application.
All Google Maps JavaScript API applications require authentication( API KEY )
Go to https://developers.google.com/maps/documentation/javascript/get-api-key.
Login with Google Account
Click on Get a key button
3 Select or create a project
Click on Enable API ( Google Maps API)
Copy YOUR API KEY in your Project: <script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=(Paste YOUR API KEY)"></script>
Update django-geoposition at least to version 0.2.3 and add this to settings.py:
GEOPOSITION_GOOGLE_MAPS_API_KEY = 'YOUR_API_KEY'
The same issue i was facing couple of months back and that is because end of free google map usage effective from i think June 11, 2018. Google does not provide free google maps now. You need to have a valid API key and valid billing used, which may give you 200$ of free usage.
Refer link for more details: Google map pricing
Follow the process here to get your api key.
If you are upto using only maps with specific user, you can try other map tools.
The script element that loads the API is missing the required authentication parameter. If you are using the standard Maps JavaScript API, you must use a key parameter with a valid API key. If you are a Premium Plan customer, you must use either a client parameter with your client ID or a key parameter with a valid API key.
See the guide to API keys and client IDs.
you must create a project and collect the key in this way:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en&key=()"></script>

Google maps: how to generate a key for Google Maps v2?

I have an old website that uses Google maps v2. Previously the website was running under http://domain1.edu. Now it is runs under http://domain2.edu. It appears that I need to update the map key.
On the internet, I was looking for how to do this. I find incomplete info at Google's own website. Here is the link for v2 map key: https://developers.google.com/maps/documentation/javascript/v2/introduction?csw=1#Obtaining_Key
It says:
To create your API key, visit the APIs Console at https://code.google.com/apis/console and log in with your Google Account.
Click the Services link from the left-hand menu, then activate the Google Maps API v2 service.
Once the service has been activated, 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
First, I am unable to find "Google Maps API v2" service mentioned above. I am able to find Google Maps API v3, and so I enabled it. I used the key mentioned at https://developers.google.com/maps/documentation/javascript/tutorial#api_key
However, the website key is still not working.
Here is the page with Google map: http://nmai.si.edu/nafvf/attend.aspx
Anyone knows how to fix this?
Thanks and regards!
You are using the deprecated Google Maps Javascript API v2, those keys are no longer available (as the documentation you point to indicates). You need to use a v3 key, and make sure you have the referrers set correctly for that key (you really should update your map to use the v3 API...)
working example (copied from Mike Williams' v2 tutorial, just changed the key)
This link says how to generate the key for android. You need to get the SHA1 of your signing key and then gotto google console to generate the key.

The Google Maps API server rejected your request

I m working on an application which renders google maps on an image as below
<img alt="Google Maps (Scotland)" src="http://maps.google.com/staticmap?size=480x200&maptype=mobile\&markers=55.9368450758,-3.03604939504,reda|55.9454374538,-3.18124534297,redb&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
The map is not getting rendered and when I right click on the source of image and click the url, I get the following message
"The Google Maps API server rejected your request. This site or IP is not authorized to use this API key."
I have checked the API Access on https://code.google.com/apis/console the API key seems to be all correct. Just wondering how to fix the site and IP bit?
See below the settings in google API console
Make sure you have enabled "Static Maps API" service in addition to "Google Maps API".
Make sure you have enabled the Google Maps related Services ("Google Maps Embed API" and "Static Maps API") like bellow:
And then mark them:
In the new layout you find it here:
It works for me when I enable "Google Maps Embed API" and "Static Maps API"
Make sure you have a Browser key in the Simple API Access section, and make sure the Referers is set to Any referer allowed
Activate Google Map Key here: https://console.developers.google.com/apis/api/maps_embed_backend/overview?project=[your-project]
It will enable your map instantly.
I had the same issue. I used this instead of this and that resolved the issue. Some other api parameters didn't work on the second URL either (specifically marker styles), guessing the old API is deprecated
Would also recommend using https as opposed to http. This way your users wont get cert warnings if they view the page over SSL
Not only you need to enable google static API, but also you need to include your api_key in the link.
From june 2018 you have to configure a billing account to continue using Maps static API; google "donate" 200$/day of credit
Maps Static API Usage and Billing
add key in the url is not enough
As commented by Pointy, you need to use an API key with all referrers allowed in order to use Static Maps.
You can achieve that just by removing all the referrers from the list of authorized referrers. Or just create a new API key and use it without further configuration.
More info at the Documentation