本文介绍了Google Maps API更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Google地图,开放图层和dojo工具包为Web应用程序构建了一个地图组件。它加载了谷歌地图和绘制的数据点。直到今天凌晨,一切正常,但突然地图停止加载。没有JavaScript错误,开放图层和谷歌仍然初始化,数据点仍然绘制在各自的位置,但地图不加载。以下是我使用的资源:

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

我刚刚尝试了Google提供的'Hello World'示例(在下面找到),并注意到它可以工作。

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

我注意到这个例子需要使用API​​密钥。我尝试将我的API密钥放入上面使用的资源中,但无济于事。我也试着复制他们在这个例子中使用的资源,并且因为它在开放层中导致错误而失败。



Google决定弃用这里的功能,我需要重建这个零件?有没有我失踪的东西?



注意:

我通过切换临时解决了生产中的问题从Google地图到开放街道地图。可以在这里找到。这也证明了问题在于加载地图,而不是别的。

解决方案

恢复到3.20版本适用于我:

 < script src =// maps.google.com/maps/api/js? v = 3.20\" >< /脚本> 

感谢@geocodezip让我走上正轨。


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.

解决方案

Reverting to version 3.20 worked for me:

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

Credit goes to @geocodezip for putting me on the right track.

这篇关于Google Maps API更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 04:59