Leaflet.Canvas-Flowmap-Layer icon indicating copy to clipboard operation
Leaflet.Canvas-Flowmap-Layer copied to clipboard

is it possible to cluster points and paths

Open Zahma opened this issue 6 years ago • 5 comments

I'm wondering if we can clusters the points and paths using markerclusterGroup. As far as I understood from this libraey its suing canvas elements, and not markers to render the flows. Is there any way you can think of to add the markerclustergroup to this one it would be wonderful. Grouping points and flows while zooming out.

Zahma avatar Sep 01 '17 07:09 Zahma

@Zahma neat idea. Specifically you mean Leaflet.markercluster, right?

As a first step in looking into this--in your own use of that plugin--did you try to see if it would support drawing to the canvas automatically, via the L.canvas LeafletJS conventions? Such as:

var canvasRenderer = L.canvas();
var markers = L.markerClusterGroup({
  renderer: canvasRenderer
});

Although I'm unsure if it even supports that and if you have to do it at the L.markerClusterGroup level or at its individual marker layers that get added to it. First I'd want to know if that is supported with that lib to help decide how to technically implement this. I would want to lean on an already established clustering plugin to help with the to/from points.

With Leaflet.Canvas-Flowmap-Layer when it comes to "clustering" the flow lines I could see that being pretty straightforward once we have the clustered markers figured out.

cc @sarahbellum

jwasilgeo avatar Sep 01 '17 15:09 jwasilgeo

@jwasilgeo I'm pretty sure markerclusterGroup doesn't support canvas it only gets Markers as parameter. One Idea I thought about is to have both libraries each working on its side. Canvas Flow Map Layer takes a Feature collection, whereas markerclustergroup takes Markers. So what I'm thinking about basically is to draw the Markers without displaying them, apply the clustering, and then do some calculations to finally construct a featurecollection object that will be then served to CanvasFlowMap for display. But this is not the best way to do it in terms of efficiency. If you have any idea or contribution I'll be grateful.

Zahma avatar Sep 03 '17 17:09 Zahma

@Zahma Hi, I'm chiming in on behalf of the visualization implications of clustering. One consideration is the complexity that clustering might add to creation of the Bezier curve line, especially if you allow zooming, where the clustering would change. The Bezier curve lines will potentially become far fewer when zoomed out, and more abundant as the user zooms in and point declustering occurs. This could be super cool!

sarahbellum avatar Sep 05 '17 13:09 sarahbellum

@Zahma I think I follow what you're saying above. "...then do some calculations to finally construct a featurecollection object that will be then served to CanvasFlowMap for display..." could totally work.

@sarahbellum thanks for bringing up the visualization feedback and concerns. Is this the behaviour you envisioned, @Zahma?

jwasilgeo avatar Sep 05 '17 14:09 jwasilgeo

@sarahbellum @jwasilgeo .Thank you both for your interest. In fact i'm working on it right now, I'll let you know of the implications.

Zahma avatar Sep 05 '17 15:09 Zahma