tilezen / vector-datasource

Tilezen vector tile service - OpenStreetMap data in several formats
https://www.nextzen.org/
Other
507 stars 119 forks source link

Reduce size of roads layer at zooms 10 and 11 #1998

Closed nvkelso closed 2 years ago

nvkelso commented 2 years ago

There are a lot of random (orphaned) unclassified and residential road segments included at zooms 10 and 11 in dense cities. These seem to be "bike" related.

Fix in in 5 parts.

Zoom 10 in London (256px tile size or 512px at 10/511/340 for research):

image

Zoom 11 in London

image

Zoom 12 in London

image

Zoom 10 in Paris: (256px tile size):

image

Zoom 11 in Paris

image

Zoom 12 in Paris

image

Part of this stems from https://github.com/tilezen/vector-datasource/issues/1250 and https://github.com/tilezen/vector-datasource/pull/1462, which solved for the rural unclassified case where those are actually regional connectors. But in the process too many random tiny urban roads (especially in Europe see London and Paris) were added. That min_zoom of 11 should be reverted to 12, those tests updated, and documentation changed.

Specifically:

    min_zoom: { clamp: { min: 0, max: 12, value: { call: { func: mz_calculate_path_major_route, args: [ { col: fid }, { col: meta.relations } ] } } } }

Some of the other roads are bike or walking related, where they get promoted up a zoom or two depending on what type or bicycle or walking relation (international, national, regional, and local) it's a member of, via https://github.com/tilezen/vector-datasource/issues/1172 and https://github.com/tilezen/vector-datasource/pull/1198.

This was done for Walkabout map style at Mapzen, but introduces extra features for a general purpose map. Let's relax those a single zoom, per https://github.com/tilezen/vector-datasource/blob/master/docs/SEMANTIC-VERSIONING.md#minor-version-increments to keep with MINOR version change.

The code to change is:

Specifically:

            CASE WHEN hstore(tags)->'network' IN ('icn', 'ncn') THEN 8
                 WHEN hstore(tags)->'network' IN ('iwn', 'nwn') THEN 9
                 WHEN hstore(tags)->'network' IN ('rcn') THEN 11
                 WHEN hstore(tags)->'network' IN ('rwn') THEN 11
                 WHEN hstore(tags)->'network' IN ('lcn') THEN 12
                 WHEN hstore(tags)->'network' IN ('lwn') THEN 12

Additionally we should drop more feature properties at zoom 12, too (changing 12 to 13), to allow more feature merging at zoom 11 and 12:

Finally, we should drop surface tags from minor roads and paths at early zooms:

We do a transform here:

Right after that we should dup the logic for

And apply that to minor roads and paths until zoom 14.

 # drop these "detail" tags to get better merging at zoom < 14
  - fn: vectordatasource.transform.drop_properties
    params:
      source_layer: roads
      start_zoom: 0
      end_zoom: 14
      properties:
        - surface
      where: >-
        kind == 'minor_road' or 
        (kind == 'path' and zoom < 13)

We should drop more properties from all kinds of roads, too:

Something more like:

 - fn: vectordatasource.transform.drop_properties
    params:
      source_layer: roads
      start_zoom: 0
      end_zoom: 15
      properties:
        - network
        - shield_text
        - bicycle_shield_text
        - bus_shield_text
        - walking_shield_text
        - hgv_restriction_shield_text
      where: >-
        (kind_detail == 'motorway' and zoom <  7) or
        (kind_detail == 'trunk' and zoom <  9) or
        (kind_detail == 'primary' and zoom <  11) or
        (kind_detail == 'secondary' and zoom <  12) or
        (kind_detail == 'tertiary' and zoom <  13) or
        (kind_detail == 'motorway_link' and zoom <  13) or
        (kind_detail == 'trunk_link' and zoom <  13) or
        (kind_detail == 'primary_link' and zoom <  14) or
        (kind_detail == 'secondary_link' and zoom <  14) or
        (kind_detail == 'tertiary_link' and zoom <  14) or
        (kind == 'minor_road' and zoom < 15) or
        (kind == 'path' and zoom < 14) or
        (kind == 'rail' and zoom < 15)

- fn: vectordatasource.transform.drop_properties
    params:
      source_layer: roads
      start_zoom: 0
      end_zoom: 15
      # short-hand for "name" property in the list below means all name-like
      # properties.
      all_name_variants: true
      properties:
        - name
        - ref
        - all_networks
        - all_shield_texts
        - service
        - access
        - osm_relation
      where: >-
        (kind == 'highway' and zoom <  11) or    
        (kind_detail == 'trunk' and zoom <  12) or
        (kind_detail == 'primary' and zoom <  13) or
        (kind_detail == 'secondary' and zoom <  14) or
        (kind_detail == 'tertiary' and zoom <  14) or
        (kind_detail == 'motorway_link' and zoom <  14) or
        (kind_detail == 'trunk_link' and zoom <  14) or
        (kind_detail == 'primary_link' and zoom <  15) or
        (kind_detail == 'secondary_link' and zoom <  15) or
        (kind_detail == 'tertiary_link' and zoom <  15) or
        (kind == 'minor_road' and zoom < 15) or
        (kind == 'path' and zoom < 14) or
        (kind == 'rail' and zoom < 15)

 - fn: vectordatasource.transform.drop_properties
    params:
      source_layer: roads
      start_zoom: 0
      end_zoom: 15
      properties:
        - service
        - surface
        - cycleway
        - cycleway_right
        - cycleway_left
        - walking_shield_text
        - hgv
        - operator
      where: >-
        (kind == 'highway' and zoom <  12) or
        (kind == 'major_road' and zoom <  13) or
        (kind == 'minor_road' and zoom < 15) or
        (kind == 'path' and zoom < 14) or
        (kind == 'rail' and zoom < 15)
nvkelso commented 2 years ago

This will require changes to the original Mapzen house styes, like https://github.com/tangrams/bubble-wrap/pull/279.

nvkelso commented 2 years ago

Closed via https://github.com/tilezen/vector-datasource/pull/2008.