开发者

Getting Google directionsService.route markers

开发者 https://www.devze.com 2023-03-30 01:52 出处:网络
I have an array of longlats (waypoints), source and destination. I have called the method directionsService.route and displayed the route on the map successfully. I need to get the references of all

I have an array of longlats (waypoints), source and destination.

I have called the method directionsService.route and displayed the route on the map successfully. I need to get the references of all the marker objects present on the map. Is there any way i can 开发者_如何学Cachieve this? Like map.getMarkers returning an array of markers on the map?


sorry it's not possible by map object but you can store the marker into the array variable

var allMarkers = [];
....
// Create some markers
for(var i = 0; i < 10; i++) {
    var marker = new google.maps.Marker({...});
    allMarkers.push(marker);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消