【发布时间】:2018-01-31 03:02:52
【问题描述】:
我正在尝试从 Places Web API 中提取一些地点,以便在地图上绘制一些标记。似乎它错误地抛出了一个错误:
Uncaught Error: Missing parameter. You must specify location. in places_impl.js:35
我的代码如下:
var bounds = map.getBounds();
var service = new google.maps.places.PlacesService(map);
service.nearbySearch({
bounds: bounds,
type: ['natural_feature']
}, callback);
它应该按照文档工作:
此方法接受具有以下字段的请求:
以下之一: bounds,必须是定义矩形搜索区域的 google.maps.LatLngBounds 对象; 或
位置和半径;前者采用 google.maps.LatLng 对象,后者采用简单整数,以米为单位表示圆的半径。最大允许半径为 50 000 米。请注意,当 rankBy 设置为 DISTANCE 时,您必须指定位置,但不能指定半径或边界。
https://developers.google.com/maps/documentation/javascript/places#place_search_requests
【问题讨论】:
标签: web-services google-maps-api-3 google-places-api