Radamirez
Radamirez

Reputation: 31

Leaflet.MarkerCluster not found function spiderfy()

i use angular and leaflet, for the cluster i use leaflet.markerCluster library but all method explain on github page give error function not found. I have include the script and the style in angular.json file, the library was installed with npm. Work only for basic use: create a marker and push in cluster with addLayer. But if i need spiderfy() invoked over L.markerCluster object i receive error function not exist. this is some code:

Creation

  private markerCluster;
        this.markerCluster = L.markerClusterGroup({
      showCoverageOnHover: false
    });

ADD TO MAP

this.map.addLayer(this.markerCluster);

add markers in a loop

var marker = this.createMarker(point);

this.markerCluster.addLayer(marker);

if i invoke goes error

this.markerCluster.spiderfy();

Upvotes: 1

Views: 878

Answers (1)

ghybs
ghybs

Reputation: 53185

spiderfy is a method for a specific cluster, whereas in your code you are trying to invoke it on your Marker Cluster Group.

Current MCG behaviour is to spiderfy only one cluster at a time, that is why trying to spiderfy the entire group makes no sense.

Upvotes: 1

Related Questions