这是indexloc提供的服务,不要输入任何密码
Skip to content

[FEATURE] [Custom map] Granular control over feature/layer detail tuning at max_zoom #1278

@zstadler

Description

@zstadler

EDIT: See #1278 (comment) below

Is your feature request related to a problem? Please describe.

Currently, Planetiler's schema uses args.min_feature_size_at_max_zoom (for features) and args.simplify_tolerance_at_max_zoom (for layers). While these serve as global defaults, the actual tolerance settings within tile_post_process.merge_line_strings for a layer, and min_size for a feature, are applied uniformly across all zoom levels (from max_zoom down to min_zoom).

This "one-size-fits-all" application creates a significant constraint when attempting to finely tune the level of detail included in vector tiles, especially in custom map workflows. Specifically, it makes it difficult to:

  • Reduce detail efficiently at lower zoom levels: Current settings force a higher level of detail than might be necessary, leading to larger tile sizes and potentially slower rendering.
  • Maintain precise detail at max_zoom while simplifying aggressively at lower zooms: We lack the ability to set a distinct simplification behavior for max_zoom versus sub-maximal zooms for these specific layer and feature properties.

Describe the solution you'd like

To provide more granular control and allow for better optimization of tile detail, I propose adding distinct settings that apply specifically at the max_zoom level for the following properties:

  • Add layer.feature[].min_size_at_max_zoom
  • Add layer.tile_post_process.merge_line_strings.tolerance_at_max_zoom
  • Add layer.tile_post_process.merge_line_strings.min_length_at_max_zoom
  • Add layer.tile_post_process.merge_polygons.min_area_at_max_zoom
  • Add layer.tile_post_process.merge_polygons.tolerance
  • Add layer.tile_post_process.merge_polygons.tolerance_at_max_zoom

This would allow users to specify different values for these properties at max_zoom, enabling more aggressive simplification or filtering at lower zoom levels while preserving high detail where needed.

Proposed Default Value Changes:

To maintain intuitive behavior and ensure backwards compatibility (where appropriate), I suggest the following default value changes:

Setting Default Value (Zoom < Max Zoom) Default Value (Zoom = Max Zoom) Comment
min_size[_at_max_zoom] min_feature_size min_feature_size_at_max_zoom 0 if tile_post_process is present.
tolerance[_at_max_zoom] simplify_tolerance simplify_tolerance_at_max_zoom Applicable for merge_line_strings or merge_polygons, when defined.
min_length[_at_max_zoom] min_feature_size min_feature_size_at_max_zoom Only applicable when merge_line_strings is defined.
min_area[_at_max_zoom] min_feature_size_at_max_zoom ^ 2 min_feature_size_at_max_zoom ^ 2 Only applicable when merge_polygons is defined.

Additionally, it may be appropriate to consider making buffer an attribute of the layer itself, rather than being nested under tile_post_process. This would offer more direct control over buffering regardless of other post-processing steps.

Describe alternatives you've considered

An alternative approach would be to allow tolerance, min_length, and min_area to accept expressions (instead of just static constants). These expressions could then dynamically refer to the current zoom level, enabling highly complex and flexible control over detail levels. While powerful, this might introduce too much complexity into the schema and its interpretation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions