Esri / esri-leaflet-cluster

Plugin for Esri Leaflet that clusters a Feature Layer using Leaflet.markercluster
http://esri.github.io/esri-leaflet/
Apache License 2.0
23 stars 23 forks source link

Fixes problem of setWhere causing features to not load outside of cur… #17

Closed keithpower closed 7 years ago

keithpower commented 7 years ago

…rent virtual grid.

esri-leaflet - v2.0.7 Leaflet 1.0.2

To reproduce:

-Zoom in to say 16 cluster2

The problem, from what I can tell is that when setWhere is called it stores the current snapshot, sends out the new requests for the new snapshot based on the 'where' clause and then removes the layers in the old snapshot.

The removeLayers in ClusteredFeatureLayer.js that gets called removes the layers from this.cluster. The problem is that subsequent calls to createLayers in ClusteredFeatureLayer.js finds the layers in this._layers which means it does not get put into the markers array via markers.push(newLayer); and never makes it back into the cluster via the call to this.cluster.addLayers(markers);.

This change appears to fix the problem, maybe not the best fix. The down side is layers will get re-added to the cluster but it ignores layers if it already has them.

I admit I did not fully run the tests, I am having problems with starting PhantomJS. I am still quite new to the whole Node thing.

jgravois commented 7 years ago

thanks for this one too! as soon as i get finished with DC Dev Summit, i'll be able to review/merge.

keithpower commented 7 years ago

Sounds great, I figured you are probably busy at the summit. Too bad I couldn't make it, your tech sessions sounds interesting.

jgravois commented 7 years ago

I admit I did not fully run the tests, I am having problems with starting PhantomJS.

i have a hunch your PhantomJS problems are the same @hamhands encountered (see https://github.com/Esri/esri-leaflet/pull/896)

jgravois commented 7 years ago

wow. i have no idea what happened to my mind back in february.

reviewed and merged. thanks for the patch and sorry for the radio silence!