yagajs / leaflet-ng2

Angular.io integration of Leaflet
https://leaflet-ng2.yagajs.org
ISC License
66 stars 26 forks source link

Plugin Implementation Marker Cluster #407

Open rafaelmacedox opened 6 years ago

rafaelmacedox commented 6 years ago

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?

atd-schubert commented 6 years ago

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

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

rafaelmacedox commented 6 years ago

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.

bpatrik commented 5 years ago

Hi @rafaelmacedox,

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