planetiler
planetiler copied to clipboard
[FEATURE] Configure zoom levels per layer
Is your feature request related to a problem? Please describe.
I would like to change min zooms of a layer. So for example I would like to don't have any buildings on z13.
Describe the solution you'd like
We discussed this in slack here.
Two solutions where proposed:
- FeatureRenderer takes PlanetilerConfig in it's constructor, then handles each feature here: https://github.com/onthegomap/planetiler/blob/a59f291d944e37d4af8da2955a9f19ef4007[…]main/java/com/onthegomap/planetiler/render/FeatureRenderer.java so we'd want to encode the mapping from layer to minzoom/maxzoom there and use it in renderPoint/renderLineOrPolygon
- FeatureCollector (what handles the setMinZoom/setMaxZoom calls) defaults each feature to the overall minzoom/maxzoom from config (source) then caps the minzoom/maxzoom from the set calls (source), so we'd want to change those calls to to call be something like config.minzoomForLayer(layer) instead of config.minzoom()
I think option 2 would be preferable here to make FeatureCollector the central place that controls layers/attribute assignment. We just need to decide what we want the command-line syntax to look like to set the maxzoom (and minzoom) for individual layers would look like? Would something like --layer-minzooms=building:14,mountain_peak:13
work?
I could see future similar arguments like:
-
--only-layers=building,mountain_peak
and--exclude-layers=building,mountain_peak
to include/exclude certain layers (currently openmaptiles profile handles these explicitly, but this would make those work across any profile) -
--exclude-attrs=building.height,building.name,mountain_peak.ele_m
-
--only-attrs=building.height,building.name,mountain_peak.ele_m
-
--attr-minzooms=mountain_peak.ele_m:10,building.height:14
This would be really great and I like the syntax 👍
@msbarry Would it be possible to configure everything per zoom level? For example I want to set different bounds per zoom level. I am mainly interested in showing a single city, but I want to allow the user to zoom-out a bit so he can see where he is, this "forces" me to include larger bounds (and resulting in larger file).