trafficonese / leaflet.extras

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras/
GNU General Public License v3.0
214 stars 74 forks source link

wish: Leaflet.Deflate #36

Closed alchenist closed 7 years ago

alchenist commented 7 years ago

https://github.com/oliverroick/Leaflet.Deflate

"Deflates lines and polygons to a marker when their screen size becomes too small in lower zoom levels."

bhaskarvk commented 7 years ago

The more I think about it the more I am convinced that this belongs in the core leaflet package. Adding the plugin and deflating shapes is quite easy, but if we need compatibility with marker clustering, then the change needs to happen in the core leaflet plugin. cc @jcheng5.

jcheng5 commented 7 years ago

I would have to do some research to make sure this is compatible with the layerManager. If it's adding and removing layers I'm worried it may not be.

bhaskarvk commented 7 years ago

Yep that's the reason why I think this needs to be in core leaflet, so that it's compatible with layerManager and ClusterControl both.

bhaskarvk commented 7 years ago

@jcheng5 I am thinking we could modify the layerManager to do what this plugin does for shape data. That way we can introduce this useful feature in a way that's idiomatic to the package. May be add deflateOption to addPolygons|addCircles|addRectangles|addPolylines. Thoughts ?

bhaskarvk commented 7 years ago

I am moving this issue to core leaflet package. If this ever gets implemented I think it should be in the core package. For now, there's a round about way of doing this. In the leaflet package Github version we have groupOptions which allows you to show/hide shapes/markers at different levels. So in theory you can add your shapes and corresponding markers in two different groups and assign them different zoom levels. That should get you similar results to the leaflet.deflate plugin.

bhaskarvk commented 7 years ago

This issue was moved to rstudio/leaflet#443