Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An option to drop features based on "rank" #351

Closed
ajfickas opened this issue Jan 18, 2017 · 4 comments
Closed

An option to drop features based on "rank" #351

ajfickas opened this issue Jan 18, 2017 · 4 comments

Comments

@ajfickas
Copy link

As I understand it, tippecanoe will drop features based on spatial distribution. Thoughts on supporting an option to drop points based solely on the "rank" of a feature instead where rank is defined as a property on a feature? So features with the lowest rank would get dropped first.

This would ideally include ordering features in the tiles based on rank as well so that features with higher rank would win in collisions during rendering.

The motivation is for use cases where preserving the most relevant data points is more important than preserving the shape of the data points. For example, showing the most relevant places of interest for a user planning a trip.

I would see supporting this as either a new tippecanoe property or as an option that specifies a feature property that defines the rank, i.e. something like --rank=your_property_name.

This might include a way to combine the rank with the spatial distribution in some way to give more control and minimize clustering, though I'm not sure how they'd be combined or whether it would be necessary. (I wonder if dropping based solely on rank may turn out to work well enough in practice for such use cases depending on how the data is rendered and used and how spatially distributed the highest ranked points happen to be for each tile.)

How feasible would this be to implement?

(This stems from a support thread between my coworker and @lyzidiamond last week in case it looks familiar!)

@e-n-f
Copy link
Contributor

e-n-f commented Jan 18, 2017

Thanks. I think the closest you can do to this right now is to make one tileset of important points (keeping everything) and another of miscellaneous points (keeping only a fraction), and then combine the two into one tileset.

For example:

tippecanoe -f -l combined -o places.mbtiles -r1 -y NAME ne_10m_populated_places.json
tippecanoe -f -l combined -o landmarks.mbtiles -Bg tl_2016_06_pointlm.json
tile-join -o combined.mbtiles landmarks.mbtiles places.mbtiles

takes all the Natural Earth cities (with -r1 to not drop points at any zoom level) and a fraction by zoom level of the TIGER landmarks of California (with -Bg to automatically choose a base zoom level below which some features will be dropped) and then uses tile-join to merge the two tilesets into one combined.mbtiles.

It should be possible to do this internally to Tippecanoe, but would require some rethinking of the way that dot-dropping works, since it works by dropping every Nth point rather than keeping the points in ranked order of preservation preference. I'll have to think about how I could restructure it the other way around.

@ajfickas
Copy link
Author

Appreciate the quick response. I'll give that a try for now and I'll stay tuned.

@ajfickas
Copy link
Author

ajfickas commented May 5, 2017

We no longer have a need for the proposed feature. Feel free to close.

An alternative we found is to specify tippecanoe's minzoom and maxzoom JSON extension properties (https://github.com/mapbox/tippecanoe#geojson-extension) for each feature based on a feature's rank, which provides a way to ensure only places in the nth percentile occur at particular zoom levels.

We also found that serving our JSON dynamically happens to work well enough for our use case.

@e-n-f
Copy link
Contributor

e-n-f commented May 5, 2017

Glad to hear you were able to find a way to make it work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants