【发布时间】:2017-04-04 20:30:51
【问题描述】:
请问在使用能检索200条结果的radarSearch方法和getDetails方法时,如何从谷歌地图获取10条以上的数据结果?我希望所有标记信息都列在地图下方的空白处。但是,我只得到了 10 个。我可以知道问题吗? 10 个结果保持不变,并且在浏览器刷新几次时可能只更改其中 1 个。
这是我用来从 Google 地图检索信息并创建标记的代码。我使用雷达搜索方法进行搜索。
function callback(results, status) {
if (status !== google.maps.places.PlacesServiceStatus.OK) {
console.error(status);
return;
}
for (var i = 0, result; result = results[i]; i++) {
addMarker(result);
}
}
function addMarker(place) {
var placesList = document.getElementById('test');
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location,
icon: {
url: 'http://maps.gstatic.com/mapfiles/circle.png',
anchor: new google.maps.Point(10, 10),
scaledSize: new google.maps.Size(10, 17)
}
});
service.getDetails(place, function(result, status) {
if (status !== google.maps.places.PlacesServiceStatus.OK) {
console.error(status);
return;
}
iname = result.name;
iLatitude = [result.geometry.location.lat()];
iLongitude = [result.geometry.location.lng()];
iAddress = [result.formatted_address];
placesList.innerHTML += '<li>' + iname +' '+ iAddress + '</li>';
});
}
结果的屏幕截图。 The marker result is nearly 200, while the listed down data only consists of 10
【问题讨论】:
-
地方服务有配额和速率限制(检查返回的状态,你正在记录它)
-
@geocodezip,先生,是不是因为 getDetails 获得了配额?正如我从文档中知道的那样,搜索方法得到了配额,但没有明确说明 getDetails 的配额。楼主,能不能详细解释一下。谢谢。
-
所有 google 的服务都有配额和速率限制,
getDetails也不例外(你应该在第 10 项之后记录状态OVER_QUERY_LIMIT) -
@geocodezip,先生,我可以用您在论坛stackoverflow.com/questions/14014074/…提出的解决方案解决OVER_QUERY_LIMIT问题吗?
标签: javascript google-maps google-maps-api-3