Clustering not working in reactive on Shiny app
I apologize in advance for not having a reproducible example available at the moment, but I have encountered an issue with trying to use clustering with add_circle_layer() in a dynamic setting. When I try, not only do I not get clusters, but I also am unable to update the underlying data with filters. If I leave cluster_options = NULL, the underlying data updates as expected when different filters are chosen. I have looked at the source code, but am struggling to isolate why this issue is occurring. I will try to make a reprex soon.
Yeah, I noticed that in a recent project. Clustering in Mapbox is a fairly involved process (https://docs.mapbox.com/mapbox-gl-js/example/cluster/) and when I wrote the wrapper, it consolidates a lot of this in a way that doesn't work for Shiny.
I'm sure there is a fix for this, but may involve some re-factoring. If you want, you can construct the clusters by hand following the same process in the Mapbox example. This is do-able by adding multiple layers and filters in mapgl, then you'd have control over the cluster IDs (which is at the root of the original problem). Getting the click-to-zoom functionality may be a little trickier this way though.