Google Maps Place服务无法正常工作,并给出下一个错误
未捕获的错误:属性半径无效。可能的原因是该值与其他属性冲突。
代码
var service = new google.maps.places.PlacesService(map);
var request = {
location: centerLatLong,
rankBy: google.maps.places.RankBy.DISTANCE,
radius: 500
};
service.nearbySearch(request, function(results, status){
if (status == google.maps.places.PlacesServiceStatus.OK){
console.log(results)
}
});
在radius
当您使用-属性不被支持rankBy:distance
。
Javascript-API的文档似乎不完整,因为它不包含使用时不允许使用半径属性的信息rankBy:distance
,但是places-Webservice的文档包含以下信息:
radius
—定义返回位置结果的距离(以米为单位)。允许的最大半径为50000米。请注意,如果指定了rankby = distance(在下面的可选参数中描述),则不得包含半径。
https://developers.google.com/places/webservice/search#PlaceSearchRequests
解决方案:删除radius
-property
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句