planetiler icon indicating copy to clipboard operation
planetiler copied to clipboard

[FEATURE] Configure zoom levels per layer

Open boldtrn opened this issue 1 year ago • 3 comments

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:

  1. 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
  2. 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()

boldtrn avatar May 01 '23 09:05 boldtrn

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

msbarry avatar May 01 '23 10:05 msbarry

This would be really great and I like the syntax 👍

boldtrn avatar May 01 '23 10:05 boldtrn

@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).

forgotPassword avatar Sep 08 '23 14:09 forgotPassword