我从我的应用程序访问谷歌地图时遇到问题,当我从java脚本循环发送超过10个请求时,我从地理编码服务获得OVER_QUERY_LIMIT异常.有没有办法,我可以摆脱这个,我尝试使用setInterval()等给一些时间延迟..但不起作用.
我有以下2个函数来拉入,地理编码和在谷歌地图中放置标记.
我不断得到一个TypeError: adds[i] is undefined,这当然导致地图的其余部分炸弹.
这是我的代码:
// Place Markers on the Map
var PlaceMarkers = function (iw, adds, gc) {
var image = {url: "http://meatmysite.com/Images/star2.png", size: new google.maps.Size(24, 24)};
var aCt = adds.length;
for(var i = 0; i < aCt; ++i) {
GetLatLng(gc, adds[i].address, function(pos) {
if(pos) {
var ipop = '<h1>' + adds[i].title + '</h1>'; // <----- TypeError: adds[i] is undefined
if(!isBlank(adds[i].url)){
ipop += '<a href="' + adds[i].url + '" target="_blank">' + adds[i].url + '</a><br />';
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 google 地图 API 显示多条路线。\n但是当尝试超过 10 条路线时,我收到 OVER_QUERY_LIMIT 异常。
\n\n使用谷歌,我发现,我需要使用回调函数异步调用 DirectionsDisplay (还无法让它工作)。我必须使用某种超时,因为每秒不能发出超过 10 个请求。
\n\n这是我到目前为止所得到的。
\n\n<!DOCTYPE html>\n<html>\n<head>\n <title>Display multiple routes</title>\n <meta name="viewport" content="initial-scale=1.0">\n <meta charset="utf-8">\n\n\n <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>\n <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&key=ENTER_API_KEY"></script>\n\n\n <style>\n /* Always set the map height explicitly to define the size of the div\n * element that contains the map. */\n #map {\n height: 100%;\n }\n /* Optional: Makes the sample page fill the window. */\n html, body {\n height: 100%;\n margin: 0;\n padding: 0;\n }\n </style>\n\n</head>\n<body>\n\n …Run Code Online (Sandbox Code Playgroud)