Skip to content

Remove early water labels #2003

@nvkelso

Description

@nvkelso

Picking up from where #1477 leftoff... There are still a lot of water labels in the mid-zoom tiles.

This is controlled with this config:

Edit something like (adjusting low zooms and then moving others by a zoom to filter out along the way each zoom):

  # some water polygon features are too small to need a label - and if we label
  # them then the label is often so prominent that it hides the polygon it's
  # for! see the images here for examples of this:
  # https://github.com/tilezen/vector-datasource/issues/1477#issuecomment-447162484
  #
  # we want to reset min_zoom on these features and screen them out if they
  # don't meet minimum sizes per zoom.
  - fn: vectordatasource.transform.update_min_zoom
    params:
      source_layer: water
      start_zoom: 4
      end_zoom: 16
      # the inclusion of "None" in the list might seem odd, but None compares
      # numerically smaller than any integer, so acts as a default for this
      # table.
      min_zoom: >-
        [min_zoom for min_zoom, area_threshold in [
            (4,  120000000000),
            (5,   80000000000),
            (6,   40000000000),
            (7,   10000000000),
            (8,     500000000),
            (9,     200000000),
            (10,     50000000),
            (11,     10000000),
            (12,      1000000),
            (13,       500000),
            (14,        50000),
            (15,        10000),
            (16,         None),
        ] if area >= area_threshold][0]
      where: >-
        kind == 'lake' and label_placement

Then there are also removing line labels, which is controlled around, it should be done before label placements are generated:

For the following kinds:

  • kind: sea, zoom < 4
  • kind: lake, zoom < 5
  • kind: river, zoom < 12
  • kind: [canal], zoom < 13
  • kind: [dam,stream], zoom < 14
  • kind: [ditch,drain], zoom < 15
  • is_tunnel: true, zoom < 16

Something like:

  - fn: vectordatasource.transform.drop_properties
    params:
      source_layer: water
      start_zoom: 0
      end_zoom: 16
      # short-hand for "name" property in the list below means all name-like
      # properties.
      all_name_variants: true
      properties:
        - name
      where: >-
        (kind == 'sea' and zoom < 4) or
        (kind == 'lake' and zoom < 5) or
        (kind == 'river' and zoom <  12) or
        (kind == 'canal' and zoom <  13) or
        (kind == 'dam' and zoom <  14) or
        (kind == 'stream' and zoom <  14) or
        (kind == 'ditch' and zoom <  15) or
        (kind == 'drain' and zoom <  15) or
        (is_tunnel == true and zoom <  16)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions