【发布时间】:2014-05-31 14:16:57
【问题描述】:
我正在尝试根据位置和半径 (https://developers.google.com/places/webservice/autocomplete#location_biasing) 偏向 google.maps.places.Autocomplete。以下返回结果,但基于客户端的 IP 而不是我指定的位置。谷歌地图自动完成如何正确地偏向位置? http://jsbin.com/nazufozeyu/1/
var autocomplete = new google.maps.places.Autocomplete(
document.getElementById('address'), {
types: ['geocode'],
radius: 1000,
location:[47.64864,-122.348927]
}
);
【问题讨论】:
-
我猜你的位置格式是问题所在。一般来说,对于 Google Maps Javascript API,您必须使用 google.maps.LatLng 对象,或像
{lat:47.64864,lng:-122.348927}这样的 latlng 文字
标签: javascript google-maps geolocation