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

Specify per layer min/max zoom? #316

Open
jatech1 opened this issue Jan 23, 2025 · 5 comments
Open

Specify per layer min/max zoom? #316

jatech1 opened this issue Jan 23, 2025 · 5 comments

Comments

@jatech1
Copy link

jatech1 commented Jan 23, 2025

Is there any way (perhaps in the layer-json) to specify min/max zoom for each layer? I know I can build each layer separately, and the use tile-join, but that turns one step into 12 steps... I know I can also add a tippecanoe json element to each feature, but that turns a simple config item into a geojson build code change and bloats every geojson file.

If the answer is that it was never added to the layer-json element, is this possible to revisit? If not, is there any drawback in using tile-join as opposed to single native multilayer build in tippecanoe? I assume it has less opportunity to optimize.

Thanks!

@e-n-f
Copy link
Collaborator

e-n-f commented Jan 23, 2025

There isn't a way to do this currently. It doesn't seem like it would be too hard to add; the main obstacle is figuring out a good syntax for specifying per-layer options. Maybe it could fit into the --named-layer format.

tile-join doesn't do any optimizing: either it makes the tile or it doesn't, but it doesn't simplify or drop features.

@jatech1
Copy link
Author

jatech1 commented Jan 23, 2025

Thank you, Erica. I appreciate your help! So it sounds like creating 10 individual pmtiles with tippecanoe and then joining with tile-join, should be pretty much identical to a single combined pmtile file created by tippecanoe? But, obviously, still easier if it can be all built at once by tippecanoe.

As for format, that is what I was thinking, also:
--named-layer={"file":"input.json", "layer":"layer1", "description":"Layer 1 data", "minzoom":2, "maxzoom":10}

If I want to have different min zoom levels for some layers in a single pmtile file (mostly point layers that I do not need at all at 0 or 1 for example), I assume they should all have the same max zoom in order for them to all overzoom beyond maxzoom properly in maplibre? Is that correct, or am I wrong? Does the maplibre style source max/min zoom control the overzoom? ie. if style says max is 10 for a pmtile source, and one of my layer data in the pmtile file ends at 8, will that layer not overzoom properly?

@e-n-f
Copy link
Collaborator

e-n-f commented Jan 23, 2025

Yes, that's right, for maplibre to overzoom these layers they all need to be present in the tiles at the maxzoom level; it will not go looking for them at lower zooms.

@jatech1
Copy link
Author

jatech1 commented Jan 24, 2025

I am going to play with this in the code... I see how the params and sources structs work and can get the min and max zooms into the sources list from the named-layer json... can you point me to the easiest place in read_input to use the source min/max as opposed to the global min/max passed in as params to that function?

@e-n-f
Copy link
Collaborator

e-n-f commented Jan 24, 2025

Thanks! Probably the easiest place to plumb it through will be as part of the serialization_state, which will then be accessible from serialize_feature, which can set the tippecanoe_minzoom and/or tippecanoe_maxzoom before it writes out the serialized feature.

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