【发布时间】:2015-03-24 12:17:36
【问题描述】:
我在我的 javascript 应用程序中使用 Places 库。当我使用service.nearbySearch() 方法查找附近的地方时,它工作正常。然后,当我发出service.getDetails() 请求时,我会为每个请求获得OVER_QUERY_LIMIT 状态。在我的开发者控制台中,我可以跟踪对 Google Maps JavaScript API v3 发出的每个请求,但我没有从地点 API 获得任何结果。
以下是部分代码:
// How I load the library
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=API_KEY"></script>
// My places request
var places = new google.maps.places.PlacesService(map);
var location = new google.maps.LatLng(lat, lng);
var request = {
location: location,
radius: radius,
types: [type]
};
places.nearbySearch(request, function(results, status, pagination) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
// Get the details for each place
var detailsRequest = { placeId: results[i].id }
places.getDetails(detailsRequest, function(place, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
console.log('PLACE', place)
} else {
console.log('STATUS', status)
}
})
};
}
有什么想法吗?
【问题讨论】:
-
您应该在 Google 地图文档中查找
OVER_QUERY_LIMIT的含义。 -
我知道这意味着什么。我没有达到接近 1k 的限制。更不用说我能够跟踪与我的 API 密钥相关联的请求数量。问题是它根本不应该返回那个
标签: javascript google-maps google-places-api