Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/nvkelso/1998-logical-changes-roa…
Browse files Browse the repository at this point in the history
…ds' into travisg/20211119-amalgam-build
  • Loading branch information
tgrigsby-sc committed Nov 20, 2021
2 parents b7b0000 + d744350 commit 1751220
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 35 deletions.
4 changes: 2 additions & 2 deletions data/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,9 @@ BEGIN
MIN(
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 10
WHEN hstore(tags)->'network' IN ('rcn') THEN 11
WHEN hstore(tags)->'network' IN ('rwn') THEN 11
WHEN hstore(tags)->'network' IN ('lcn') THEN 11
WHEN hstore(tags)->'network' IN ('lcn') THEN 12
WHEN hstore(tags)->'network' IN ('lwn') THEN 12
ELSE NULL
END
Expand Down
2 changes: 1 addition & 1 deletion docs/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ To improve performance, some road segments are merged at low and mid-zooms. To f

**Roads** from **Natural Earth** are used at low zooms below 8. Road `kind_detail` values are limited to `motorway`, `trunk`, `primary`, `secondary`, `tertiary`.

**Roads** from **OpenStreetMap** are shown starting at zoom 8 with `motorway`, `trunk`, `primary`. `secondary` are added starting at zoom 10, with `motorway_link`, `tertiary`, `unclassified`, and paved grade1 `track` added at zoom 11. Zoom 12 sees addition of `trunk_link`, `residential`, `road`, and grade1 and grade2 `track`. Zoom 13 adds `primary_link`, `secondary_link`, `raceway`, remaining `track`, `pedestrian`, `living_street`, `cycleway` and `bridleway`. Zoom 14 adds `tertiary_link`, all remaining `path`, `footway`, and `steps`, `corridor`, and `alley` service roads. By zoom 15 all remaining service roads are added, including `driveway`, `parking_aisle`, `drive_through`. Internationally and nationally significant paths (`path`, `footway`, `steps`) are added at zoom 9, regionally significant paths are added at zoom 11, locally significant at zoom 12, and named or designated paths at zoom 13. Internationally and nationally significant bicycle routes are added at zoom 8, regionally significant bike routes at zoom 10, and locally significant at zoom 11.
**Roads** from **OpenStreetMap** are shown starting at zoom 8 with `motorway`, `trunk`, `primary`. `secondary` are added starting at zoom 10, with `motorway_link`, `tertiary`, and paved grade1 `track` added at zoom 11. Zoom 12 sees addition of `trunk_link`, `unclassified`, `residential`, `road`, and grade1 and grade2 `track`. Zoom 13 adds `primary_link`, `secondary_link`, `raceway`, remaining `track`, `pedestrian`, `living_street`, `cycleway` and `bridleway`. Zoom 14 adds `tertiary_link`, all remaining `path`, `footway`, and `steps`, `corridor`, and `alley` service roads. By zoom 15 all remaining service roads are added, including `driveway`, `parking_aisle`, `drive_through`. Internationally and nationally significant paths (`path`, `footway`, `steps`) are added at zoom 9, regionally significant paths are added at zoom 11, locally significant at zoom 12, and named or designated paths at zoom 13. Internationally and nationally significant bicycle routes are added at zoom 8, regionally significant bike routes at zoom 10, and locally significant at zoom 11.

**Ferries** from both Natural Earth and OpenStreetMap are shown starting at zoom 5 with `kind` values of `ferry`.

Expand Down
186 changes: 155 additions & 31 deletions queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ post_process:
params:
source_layer: roads
start_zoom: 0
end_zoom: 12
end_zoom: 13
properties:
- bicycle
- colour
Expand All @@ -1030,17 +1030,8 @@ post_process:
- symbol
- tracktype
- type # NVK (2017425): this is a suspicious tag

# drop certain road properties at lower zooms
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
properties:
- all_walking_networks
- all_walking_shield_texts
- all_bus_networks
- all_bus_shield_texts
# drop all_bicycle_* until the max zoom:
# https://github.com/tilezen/vector-datasource/pull/1707#discussion_r236522176
- fn: vectordatasource.transform.drop_properties
Expand All @@ -1049,8 +1040,13 @@ post_process:
start_zoom: 0
end_zoom: 16
properties:
- all_walking_networks
- all_walking_shield_texts
- all_bicycle_networks
- all_bicycle_shield_texts
- all_bus_networks
- all_bus_shield_texts

# drop certain road properties at lower zooms
- fn: vectordatasource.transform.drop_properties
params:
Expand All @@ -1075,13 +1071,14 @@ post_process:
- sidewalk_right
- sport
- trail_visibility

# drop name and other properties on early paths to
# allow more line merging (use walking network for labeling)
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 12
end_zoom: 13
# this means remove all the names if "name" is one of the properties
# we're dropping. in other words, allows us to use "name" as a short-
# hand for name:XX, official_name, old_name, etc... without having to
Expand All @@ -1092,6 +1089,64 @@ post_process:
- ref
where: >-
kind == 'path'
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 15
properties:
- bus_network
- walking_network
- bicycle_network
where: >-
(kind == 'highway' and zoom < 13) or
(kind == 'major_road' and zoom < 14) or
(kind == 'minor_road' and zoom < 15)
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 15
properties:
- bus_shield_text
- bus_shield_text_length
- bicycle_shield_text
- bicycle_shield_text_length
- walking_shield_text
- walking_shield_text_length
- hgv_restriction_shield_text
- hgv_restriction_shield_text_length
where: >-
(kind == 'highway' and zoom < 12) or
(kind == 'major_road' and zoom < 13) or
(kind == 'minor_road' and zoom < 15)
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 15
properties:
- network
- shield_text
- shield_text_length
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
Expand All @@ -1103,16 +1158,47 @@ post_process:
properties:
- name
- ref
- network
- shield_text
- all_networks
- all_shield_texts
- bus_network
- bus_shield_text
- 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) or
(kind == 'minor_road' and zoom < 14) or
(kind == 'major_road' and zoom < 7)
(kind == 'ferry' 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
- 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)
# drop these "detail" tags to get better merging at zoom < 16
- fn: vectordatasource.transform.drop_properties
params:
Expand Down Expand Up @@ -1183,6 +1269,18 @@ post_process:
sand: unpaved
woodchips: unpaved

# 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)
# drop to get better merging at mid zooms.
- fn: vectordatasource.transform.drop_properties
params:
Expand Down Expand Up @@ -1234,12 +1332,12 @@ post_process:
- private

# this is a patch because we still want to drop name, network from major_road
# features between zoom 7 and 10
# features between zoom 7 and 11
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 7
end_zoom: 11
end_zoom: 12
# short-hand for "name" property in the list below means all name-like
# properties.
all_name_variants: true
Expand All @@ -1250,12 +1348,12 @@ post_process:
where: >-
kind == 'major_road'
# this is a patch to get rid of name, but keep ref & network, for highways
# when zoom < 11.
# when zoom < 12.
- fn: vectordatasource.transform.drop_names
params:
source_layer: roads
start_zoom: 7
end_zoom: 11
end_zoom: 12
where: >-
kind == 'highway'
# drop name, ref and the multi-shield properties, but keep single-shield
Expand All @@ -1275,21 +1373,24 @@ post_process:
- all_shield_texts
- walking_network
- walking_shield_text
- walking_shield_text_length
- bicycle_network
- bicycle_shield_text
- bicycle_shield_text_length
where: >-
kind == 'highway'
# drop non-road shield stuff a good deal earlier.
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 11
end_zoom: 12
properties:
- all_walking_networks
- all_walking_shield_texts
- bus_network
- bus_shield_text
- bus_shield_text_length
- all_bus_networks
- all_bus_shield_texts
where: >-
Expand Down Expand Up @@ -1340,39 +1441,39 @@ post_process:
properties:
- walking_network
- walking_shield_text
# drop RCN network & shield text below zoom 11, and shield text at one more
- walking_shield_text_length
# drop RCN network & shield text below zoom 13, and shield text at one more
# zoom.
# https://github.com/tilezen/vector-datasource/pull/1707#discussion_r236522771
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 11
end_zoom: 13
properties:
- bicycle_network
- bicycle_shield_text
where: >-
bicycle_network == 'rcn'
- bicycle_shield_text_length
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 12
end_zoom: 14
properties:
- bicycle_shield_text
where: >-
bicycle_network == 'rcn'
- bicycle_shield_text_length
# drop LCN network & shield text below zoom 14 and shield text only at
# one more zoom level. (should be present at zoom 15).
# https://github.com/tilezen/vector-datasource/pull/1707#discussion_r236523895
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
end_zoom: 15
properties:
- bicycle_network
- bicycle_shield_text
- bicycle_shield_text_length
where: >-
bicycle_network == 'lcn'
- fn: vectordatasource.transform.drop_properties
Expand All @@ -1382,6 +1483,7 @@ post_process:
end_zoom: 15
properties:
- bicycle_shield_text
- bicycle_shield_text_length
where: >-
bicycle_network == 'lcn'
# drop any bicycle network & shield text on tracks below zoom 13.
Expand All @@ -1394,6 +1496,7 @@ post_process:
properties:
- bicycle_network
- bicycle_shield_text
- bicycle_shield_text_length
where: >-
kind == 'path' and kind_detail == 'track'
- fn: vectordatasource.transform.update_parenthetical_properties
Expand Down Expand Up @@ -1609,6 +1712,27 @@ post_process:
- landuse_kind
where: >-
landuse_kind in ('residential', 'industrial')
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 8
end_zoom: 14
properties:
- landuse_kind
where: >-
(kind_detail == 'trunk' and zoom < 11) or
(kind_detail == 'primary' and zoom < 12) or
(kind_detail == 'secondary' and zoom < 13) or
(kind_detail == 'tertiary' and zoom < 13) 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 < 14)
# drop osm_relation tag, used to indicate that shapes came from OSM relations.
# however, it interferes with merging.
Expand Down
2 changes: 1 addition & 1 deletion yaml/roads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ filters:
#############################################################
- filter:
highway: [unclassified]
min_zoom: { clamp: { min: 0, max: 11, value: { call: { func: mz_calculate_path_major_route, args: [ { col: fid }, { col: meta.relations } ] } } } }
min_zoom: { clamp: { min: 0, max: 12, value: { call: { func: mz_calculate_path_major_route, args: [ { col: fid }, { col: meta.relations } ] } } } }
table: osm
output:
<<: [*osm_highway_properties, *osm_network]
Expand Down

0 comments on commit 1751220

Please sign in to comment.