Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API change?

I built a map component for a web application using google maps, open layers, and the dojo toolkit. It loaded a google map and plotted data points. Until early this morning everything was working just fine, but suddenly the map stopped loading. There are no JavaScript errors, open layers and google still initialize, the data points still plot in their respective locations, but the map does not load. Below are the resources I am using:

<script src="//openlayers.org/api/OpenLayers.js"></script>
<script src="//maps.google.com/maps/api/js?v=3&libraries=places&sensor=false"></script>

I just tried the 'Hello World' example google provides ( found below ) and noticed that it works.

https://developers.google.com/maps/documentation/javascript/tutorial

I noticed that example requires the use of an API Key. I tried putting my API key into the resource used above, but to no avail. I also tried copying the resource they use in the example and that failed because it caused errors in open layers.

Has Google decided to deprecate functionality here and I need to rebuild this component? Is there something I'm missing?

NOTE:

I have temporarily solved my issue in production by switching from Google Maps to Open Street Maps. It can be found here https://www.beaconsinspace.com/map. This also proves the problem lies in loading the map, and not something else.

like image 665
John Foley Avatar asked Sep 01 '15 15:09

John Foley


People also ask

How do I customize Google Maps API?

Use Cloud-based Maps Styling To get started with Cloud-based maps styling, copy the JSON style above, then go to the Google Cloud console. To create a new map style, paste the JSON into the 'Import JSON' option. Cloud-based maps styling is available for the Maps JavaScript API at no extra charge.

How do I change my Google Maps API key?

Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.

Can you style Google Maps API?

Google Maps Platform offers Cloud-based maps styling features that make it easy to style, customize, and manage your maps using the Google Cloud Console, letting you create a customized map experience for your users without having to update your apps' code each time you make a style change.


1 Answers

Thanks to the answer by @geocodezip and the comment by @benjamin I have found the solution.

What has happened is a google API update ( as described in @geocodezip answer ). The solution for me was to specify api version 3.20:

<script src="//maps.google.com/maps/api/js?v=3.20&sensor=false"></script>

--OR--

<script src="//maps.googleapis.com/maps/api/js?v=3.20&sensor=false"></script>
like image 111
John Foley Avatar answered Nov 06 '22 15:11

John Foley