Hi I am using the Angular Google Maps library available here https://github.com/nlaplante/angular-google-maps. it seems pretty powerful but it lacks exhaustive documentation... I am trying to cluster my markers but I can't find a working example of how to do it. Did anyone manage to do it ?
The question is a bit old, but maybe this can be useful for someone with the same issue.
Here is a simple example from the code I used:
On my controller, I generate a markers array with this structure:
var markers = new Array();
for(var i = 0; i < someData.length; i++ ){
var newMarker = {
id: parseInt(i),
latitude: parseFloat(someData[i].latitude),
longitude: parseFloat(someData[i].longitude),
showWindow: false,
title: "Marker"+i,
}
newMarker.onClicked = function () {
alert(newMarker.id);
}
markers.push(newMarker);
}
$scope.markers = markers;
Then on the view:
<google-map center="map.center" draggable="true" options=map.options zoom="map.zoom">
<markers models="markers" coords="'self'" doCluster=true click="'onClicked'">
</markers>
</google-map>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With