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

adding tile level data to features during build #253

Open
agoddard opened this issue Aug 7, 2024 · 1 comment
Open

adding tile level data to features during build #253

agoddard opened this issue Aug 7, 2024 · 1 comment

Comments

@agoddard
Copy link

agoddard commented Aug 7, 2024

Hello! Thanks for all of the incredible work on Tippecanoe!
I am looking for ways to augment attributes in pmtiles per-tile and wondering if there's a way to do this already in Tippecanoe? From my understanding it could be similar to a pre filter but where the script that was executed per tile returned data to add as attributes on features. I think a workaround exists where a prefilter script renders a geojson per tile, then this geojson can be augmented and turned back into pmtiles with tippecanoe, but I'm not sure if there's disadvantages to doing it this way.

In terms of an example use-case, lets say there is a highway feature and the highway goes from NYC to LA, I would like to tag the feature with "state" but the value of "state" would change depending on the zoom/tile. If you look at a zoom 14 tile in the middle of Kansas, the attribute would be Kansas, and the tiles in Colorado would change to Colorado, etc. The values would be populated by a third party script executed by the shell script, much like pre filters are.

Is there a way to achieve this today in Tippecanoe?

@e-n-f
Copy link
Collaborator

e-n-f commented Aug 7, 2024

The disadvantage to prefilters is that they turn out to be really slow, because all of the tiling threads have to wait for the filter to finish running before they can continue.

I think what I should have done instead is to have made the prefilter and postfilter be a python or node script invoked in an embedded interpreter within the tippecanoe process rather than an external shell script. I never actually started down the road of implementing anything like that, though.

Rather than trying to wedge it into tippecanoe, I would be tempted to do the attribute augmentation as a postprocessing step: iterate through the tiles in a python script or something, mutate the attributes, and write the modified tiles back out.

Within tippecanoe itself, the most straightforward place to mutate the tile would be here, at the point of the existing call to the postfilter, after everything in the tile has been assembled, just before actually encoding it.

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

No branches or pull requests

2 participants