leaflet-ng2 icon indicating copy to clipboard operation
leaflet-ng2 copied to clipboard

Plugin Implementation Marker Cluster

Open rafaelmacedox opened this issue 6 years ago • 3 comments

Hello everyone, I have a angular project using yaga leaflet, I need to implement the markercluster plugin, I am using the yaga-feature-group and yaga-marker directives. I saw that there is an issue already open, but I still could not implement what I need, could anyone help me?

rafaelmacedox avatar Jul 18 '18 20:07 rafaelmacedox

Do you have specific questions? I can try to help you.

Maybe I will find some time to implement a MarkerCluster Plugin next months.

atd-schubert avatar Jul 24 '18 07:07 atd-schubert

I'm using directives to create layers

<yaga-marker *ngFor="let alarm of allVehicles" [(lat)]="alarm.latitude" [(lng)]="alarm.longitude" [display]="alarm.display">
              <yaga-icon
                [iconUrl]="'assets/true_truckk.png'"
                [iconSize]="[40,45]"
                [iconAnchor]="[23,44]"
                [popupAnchor]="[-5,-42]">
              </yaga-icon>
</yaga-marker>

To use the Marker Cluster I must do

var markers = new L.MarkerClusterGroup();
markers.addLayer(L.marker([175.3107, -37.7784]));
map.addLayer(markers);

So in yagajs/leaflet I should do:

@ViewChild(MapComponent) private mapComponent: MapComponent;

let markers = (L as any).MarkerClusterGroup();
markers.addLayer( ??????????? );
mapComponent.addLayer(markers);

In this part I do not know how to proceed, how should I recover all my makers and after that where I add them.

rafaelmacedox avatar Aug 06 '18 17:08 rafaelmacedox

Hi @rafaelmacedox,

Could you figure out a easy/ proper way of doing clustering? Thank you!

bpatrik avatar Jul 20 '19 21:07 bpatrik