我想在绘制的多边形内找到商店,但却无法找到任何解决方案。我在地图中有多个多边形,需要显示每个多边形的特定商店类型的数量。
geocoder.geocode({
'address': placeName
}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var geometry = results[0].geometry,
places = new google.maps.places.PlacesService(bgMap);
places.nearbySearch({
bounds: bounds,
types: [
'establishment'
]
}, function (results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
markers.push(new google.maps.Marker({
position: results[i].geometry.location,
map: bgMap
}));
}
}
});
//console.log(markers);
} else {
return $('#map').html('could not locate you');
}
});
bounds是坐标列表;