gpt4 book ai didi

google-maps - 谷歌地图 v3 API 错误

转载 作者:行者123 更新时间:2023-12-04 14:54:34 26 4
gpt4 key购买 nike

我在我的一个网站上使用 Google Maps v3 API,一切正常。然而,从昨天开始,每次我尝试访问 map 页面时突然出现这个错误:

Error: Script terminated by timeout at: 
f@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:1:175
next@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:2:310
hx@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:7:457
_.jl.prototype.Yb<@http://maps.googleapis.com/maps-api-v3/api/js/3/1a/map.js:54:163
Uy@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:38:313
Xy/<@http://maps.googleapis.com/maps-api-v3/api/js/32/1a/map.js:39:307

知道为什么会这样吗?

最佳答案

这是纬度和经度的问题。

纬度和经度应该是“浮点”数字。如果我们将其他数据类型传递给它,它会卡住浏览器,因为它正在等待具有错误数据类型的谷歌响应。

function drawMap( lat, lng ) { lat = parseFloat(lat); lng = parseFloat(lng); if ( ! isNaN( lat ) && ! isNaN( lng ) ) // Before sending it to google let check if they are valid values
{
var mapOptions = {
center: new google.maps.LatLng(44.5452, -78.5389),
zoom: 5
};
map = new google.maps.Map(document.getElementById('vehicle_country_region_from_map'), mapOptions);
}}

关于google-maps - 谷歌地图 v3 API 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48843533/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com