tippecanoe icon indicating copy to clipboard operation
tippecanoe copied to clipboard

Add `getClusterExpansionZoom`-like property to clustered points

Open austinbirch opened this issue 7 years ago • 3 comments

Hello,

First of all thanks for this library, it’s incredible!

I’m making a quite interactive map that’s plotting ten’s of thousands of dense points, so I’m using --cluster-densest-as-needed to prevent the map looking too noisy at low zooms and to keep the tiles below the size limit.

This is working great, but it’s hard to know how far to zoom in in order to expand the clustered points (to support click-to-zoom behaviour on clusters).

supercluster has a getClusterExpansionZoom (https://github.com/mapbox/supercluster#getclusterexpansionzoomclusterid) which returns the next zoom level in which the cluster is broken into fewer points - would it be possible to add similar functionality to tippecanoe’s clustering support by adding an extra clusterExpansionZoom-like property to each clustered point?

Thanks, Austin

austinbirch avatar Jul 17 '19 16:07 austinbirch

Thanks! Unfortunately I don't think it's possible to provide a clusterExpansionZoom property to clustered points, since when zoom level N is being created, Tippecanoe doesn't know yet what the size of the tiles at zoom level N+1 will be, and therefore doesn't know which points will be clustered at that zoom level.

e-n-f avatar Jul 18 '19 00:07 e-n-f

Thought that might be the case. I’ll have a bit of a rethink on approach.

As an aside, I think the following in the readme is maybe incorrect:

The remaining feature will be given a "cluster": true attribute to indicate that it represents a cluster

I seem to get a "clustered": true attribute on each clustered point instead.

Thank you for the quick reply.

austinbirch avatar Jul 18 '19 08:07 austinbirch

Thanks! I'll fix the documentation to match the actual behavior.

e-n-f avatar Jul 18 '19 15:07 e-n-f