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

Remove early water labels #2003

Closed
nvkelso opened this issue Nov 18, 2021 · 6 comments
Closed

Remove early water labels #2003

nvkelso opened this issue Nov 18, 2021 · 6 comments
Assignees
Milestone

Comments

@nvkelso
Copy link
Member

nvkelso commented Nov 18, 2021

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)
nvkelso added a commit that referenced this issue Nov 18, 2021
@nvkelso
Copy link
Member Author

nvkelso commented Nov 18, 2021

We also want to fix the min_zoom of huge water features that pop in at zoom 8 from OSM, so they have more consistent min_zoom with what's in NE in previous zooms. One would think the transform in the first comment would fix that, but it doesn't seem to be working. Instead the basic areas > min_zoom from the polygons are carried forward to the label placement points. Both should be adjusted, though ideally the label placement ones also get applied.

The min_zoom on OSM features is set there, and currently has a zoom 7 area threshold, but we need to extend that.

The OSM data itself only comes in at zoom 8, per:

So it's okay to have smaller min_zooms in the data, it won't actually make those OSM features show up earlier.

@nvkelso
Copy link
Member Author

nvkelso commented Nov 18, 2021

To promote more feature merging, we'll also want to drop names and many other properties from the water polygons (and sometimes lines) at low and mid-zooms before they are merged.

@nvkelso
Copy link
Member Author

nvkelso commented Nov 18, 2021

Area filter something like:

zoom area
1 20,000,000,000
2 10,000,000,000
3 5,000,000,000
4 2,000,000,000
5 500,000,000
6 200,000,000
7 50,000,000

@nvkelso
Copy link
Member Author

nvkelso commented Dec 15, 2021

PR is #2010.

@nvkelso nvkelso added this to the v1.9.0 milestone Jan 7, 2022
@nvkelso nvkelso self-assigned this Jan 7, 2022
@nvkelso
Copy link
Member Author

nvkelso commented Jan 7, 2022

In #2010 because of:

    (kind == 'water' and zoom <  12) or

and the way OSM tags water and Tilezen ETLs the tags, this results in too many water labels being removed.

Related: if #984 were implemented then this problem would partly resolve itself. But we should consider a lower zoom number for water, too.

This kind issue is listed as a gotcha in https://github.com/tilezen/vector-datasource/blob/5dfc1d1d697a648f846646a4a20596b2b98b19e6/docs/layers.md#water as a planned fix. There's a debate to be had if that would be a breaking change (even if planned since v1.0), so let's adjust the water zoom here only, then to #984 in the v2 milestone.

@nvkelso
Copy link
Member Author

nvkelso commented Apr 29, 2022

Via #2047

@nvkelso nvkelso closed this as completed Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant