How to implement the Marker Cluster plugin using Yagajs/leaflet

Asked

Viewed 27 times

0

I want to implement the plugin Marker Cluster in my project using the yagajs/Leaflet.

In the Marker Cluster documentation, they say I simply need to use the following code:

var markers = new L.MarkerClusterGroup();

markers.addLayer(L.marker([175.3107, -37.7784]));
// add more markers here...

map.addLayer(markers);

However, in yagajs/leaflet we do not use the namespace L, much less the addLayer method, everything is done by directives, as in the code below:

<yaga-marker *ngFor="let alarm of allVehicles" [(lat)]="alarm.latitude" [(lng)]="alarm.longitude" [display]="alarm.display">
              <yaga-icon *ngIf="alarm.speed>5"
                [iconUrl]="'assets/truckk.png'"
                [iconSize]="[40,45]"
                [iconAnchor]="[23,44]"
                [popupAnchor]="[-5,-42]">
              </yaga-icon>
              <yaga-popup>{{ alarm.customer_child_name }} - {{ alarm.speed }} - {{ alarm.vehicle_plates }}</yaga-popup>
            </yaga-marker>
          </yaga-feature-group>

How should I implement this? Aiming that in the yagajs/leaflet documentation they offer the resource of providers for such. But I could not understand them.

  • 1

    It is probably possible to do both. But from a review at this first link, it is version 0.1, the most current version is 1.3, may have changed in new versions

  • Well, you can even do following the leaflet documentation, using the namespace L, but this does not follow the good practices of Typescript, because in addition to every plugin redefine the namespace L I will still lose the typing of Typescript.... I really need to find a way by following what I’m doing, by using the directives.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.