Skip to content

earlier bike roads (and walking routes) #1198

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

Merged
merged 47 commits into from
Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
797ce83
[docs] update zoom range description for paths, and add for bike routes
nvkelso Apr 7, 2017
0d14324
show important paths and bike routes earlier
nvkelso Apr 7, 2017
54228ed
Merge branch 'master' into nvkelso/1170-earlier-bike-roads
nvkelso Apr 7, 2017
9bd8ad6
[tests] super early path and roads when bike, walking routes
nvkelso Apr 10, 2017
826a239
remove outdated v1.0.0 migrations
nvkelso Apr 10, 2017
27a5926
add v1.1.0 migrations (for *wn and *cn lines and relations)
nvkelso Apr 10, 2017
647c277
limit migration to only (mostly) highway tags in lines table
nvkelso Apr 11, 2017
e67e6b5
reformat test; and test for kind=path
nvkelso Apr 11, 2017
d380e9a
Revert "remove outdated v1.0.0 migrations"
nvkelso Apr 11, 2017
646a3af
skip failing test to validate the others
nvkelso Apr 11, 2017
80f4c1d
skip another failing test
nvkelso Apr 11, 2017
7421acc
what about Seattle
nvkelso Apr 11, 2017
25eab5d
Merge branch 'master' into nvkelso/1170-earlier-bike-roads
nvkelso Apr 11, 2017
5d75b16
[tests] add back in z10 bike routes
nvkelso Apr 11, 2017
459d64d
[tests] add in zoom 8 national cycle route
nvkelso Apr 11, 2017
5a87cc5
[tests] well, what about restating zoom 10 test?
nvkelso Apr 11, 2017
55776eb
[tests] fix coord typo
nvkelso Apr 11, 2017
e6817df
[tests] remove v1.0 sql again (more targeted)
nvkelso Apr 11, 2017
bd1c818
[tests] add back in SF Bay Trail z10 test
nvkelso Apr 11, 2017
671b226
[tests] add z8 bike road in Denmark
nvkelso Apr 11, 2017
117f5f6
[tests] add z8 bike ferry between DEU and DEN
nvkelso Apr 11, 2017
ea3f5b8
[tests] add z8 icn
nvkelso Apr 11, 2017
a07982e
[tests] skip icn, look at lwn
nvkelso Apr 11, 2017
a237eb2
[tests] add SF and Yosemite paths
nvkelso Apr 11, 2017
b620cc5
add IWN and add ICN
nvkelso Apr 11, 2017
35a7b71
be less selective about walking_network tests
nvkelso Apr 11, 2017
1bf4eca
[tests] remove duplicate test that fails
nvkelso Apr 11, 2017
a4513a9
[tests] disable failing z10 walking test
nvkelso Apr 12, 2017
5ab7d86
Merge branch 'master' into nvkelso/1170-earlier-bike-roads
nvkelso Apr 12, 2017
c5ce01c
[tests] update tile coord for SF
nvkelso Apr 13, 2017
c1b1193
[migration] fix version number
nvkelso Apr 13, 2017
9baa1be
Merge branch 'master' into nvkelso/1170-earlier-bike-roads
nvkelso Apr 24, 2017
94d7818
add more relations for early path test
nvkelso Apr 24, 2017
ec081ec
fix failing shield test, and work towards #1214
nvkelso Apr 24, 2017
36dba96
[tests] disable failing zoom 8 test
nvkelso Apr 24, 2017
27f5ef5
[tests] add network tags to tests
nvkelso Apr 25, 2017
f68e5fa
[tests] restore Merced Trail test but at one later zoom
nvkelso Apr 25, 2017
80c480c
[tests] switch around zoom 8 international cycleway test
nvkelso Apr 25, 2017
999f5fb
[tests] update all_* network, shield text tests for #1214
nvkelso Apr 25, 2017
392c88e
remove unnecesary INDEX creation (UPDATE takes care of that for us)
nvkelso Apr 25, 2017
7cd5ffc
adjust when walking, bicycle networks properties are included
nvkelso Apr 25, 2017
c818d12
[tests] update zoom 11 PCT test to use walking_network
nvkelso Apr 25, 2017
3c620cd
paths should have names starting at zoom 12
nvkelso Apr 25, 2017
c9fd198
end_zoom is ≤
nvkelso Apr 25, 2017
bcf8ada
[tests] use correct walking shield text
nvkelso Apr 25, 2017
23f6d91
drop more road layer properties early, adjust when for others
nvkelso Apr 25, 2017
3612214
[tests] zoom 13 path test is name only (no network)
nvkelso Apr 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions data/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,12 @@ BEGIN
RETURN (
SELECT
MIN(
CASE WHEN hstore(tags)->'network' IN ('iwn', 'nwn', 'icn','ncn') THEN 11
WHEN hstore(tags)->'network' IN ('rwn', 'rcn') THEN 12
WHEN hstore(tags)->'network' IN ('lwn', 'lcn') THEN 13
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 ('rwn') THEN 11
WHEN hstore(tags)->'network' IN ('lcn') THEN 11
WHEN hstore(tags)->'network' IN ('lwn') THEN 12
ELSE NULL
END
)
Expand Down Expand Up @@ -898,7 +901,7 @@ BEGIN
END;
$$ LANGUAGE plpgsql IMMUTABLE;

--- Identifies and returns the min_zoom for gates
--- Identifies and returns the min_zoom for gates
--- given the highway level of gate location
CREATE OR REPLACE FUNCTION mz_get_min_zoom_highway_level_gate(val_osm_id BIGINT)
RETURNS SMALLINT AS $$
Expand Down
9 changes: 9 additions & 0 deletions data/migrations/v1.3.0-line.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
UPDATE planet_osm_line
SET mz_road_level = mz_calculate_min_zoom_roads(planet_osm_line.*)
WHERE
(tags -> 'highway' IN ( 'trunk_link', 'primary_link', 'secondary_link', 'tertiary_link',
'residential', 'unclassified', 'road', 'living_street', 'pedestrian',
'path', 'track', 'cycleway', 'bridleway', 'footway', 'steps',
'service' ) OR
tags -> 'whitewater' = 'portage_way')
AND mz_calculate_min_zoom_roads(planet_osm_line.*) IS NOT NULL;
4 changes: 2 additions & 2 deletions docs/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -1103,10 +1103,10 @@ To improve performance, some road segments are merged at low and mid-zooms. To f

#### Road Transportation `kind_detail` values and zoom ranges:

**Roads** from **OpenStreetMap** are shown starting at zoom 8 with `motorway`, `trunk`, `primary`. `secondary` are added starting at zoom 10, with `motorway_link`, `tertiary` added at zoom 11. Zoom 12 sees addition of `trunk_link`, `residential`, `unclassified`, and `road`, and internationally and nationally significant paths (`path`, `footway`, `steps`). Zoom 13 adds `primary_link`, `secondary_link`, `raceway`, `track`, `pedestrian`, `living_street`, `cycleway` and `bridleway` and regionally significant and/or named or designated paths. 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`.

**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` added at zoom 11. Zoom 12 sees addition of `trunk_link`, `residential`, `unclassified`, and `road`. Zoom 13 adds `primary_link`, `secondary_link`, `raceway`, `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`.

![image](images/mapzen-vector-tile-docs-roads-railway.png)
Expand Down
90 changes: 90 additions & 0 deletions integration-test/1170-very-early-paths-and-bike-routes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# highway=path, with route inter-national
# GR5-Grand Traverse de Jura between France and Switzerland
# https://www.openstreetmap.org/way/285975282
# https://www.openstreetmap.org/relation/6009161
assert_has_feature(
9, 265, 179, 'roads',
{ 'kind': 'path', 'walking_network': 'iwn' } )

# highway=path, with route national (Pacific Crest Trail) at zoom 9
# https://www.openstreetmap.org/way/236361475
# https://www.openstreetmap.org/relation/1225378
assert_has_feature(
9, 86, 197, 'roads',
{ 'kind': 'path', 'walking_network': 'nwn' } )

# highway=path, with route regional (Merced Pass Trail) at zoom 11
# https://www.openstreetmap.org/way/373491941
# https://www.openstreetmap.org/relation/5549623
assert_has_feature(
11, 343, 792, 'roads',
{ 'kind': 'path', 'walking_network': 'rwn' } )

# highway=unclassified, with route local (Grant Avenue) at zoom 12
# part of The Barbary Coast Trail in San Francisco
# https://www.openstreetmap.org/way/91181758
# https://www.openstreetmap.org/relation/6322028
assert_has_feature(
12, 655, 1582, 'roads',
{ 'kind': 'minor_road', 'walking_network': 'lwn' } )

# Way: North Sea Cycle Route - part Netherlands (1977662)
# A really long highway=cycleway
# https://www.openstreetmap.org/way/35568189
# https://www.openstreetmap.org/relation/1977662
# https://www.openstreetmap.org/relation/1975739
# https://www.openstreetmap.org/relation/5294
# https://www.openstreetmap.org/relation/537418
assert_has_feature(
8, 131, 83, 'roads',
{ 'kind': 'path', 'is_bicycle_related': True, 'bicycle_network': 'icn' })

# Ferry between Denmark and Germany, icn
# https://www.openstreetmap.org/way/128631318
# https://www.openstreetmap.org/relation/721738
assert_has_feature(
8, 136, 81, 'roads',
{ 'kind': 'ferry', 'is_bicycle_related': True, 'bicycle_network': 'icn' })

# Søndervangsvej minor road in Denmark as national cycle route
# https://www.openstreetmap.org/way/149701891
# https://www.openstreetmap.org/relation/349521
assert_has_feature(
8, 136, 79, 'roads',
{ 'kind': 'minor_road', 'is_bicycle_related': True, 'bicycle_network': 'ncn' })

# Part of Bay Trail in South (San Francisco) Bay
# way is marked rcn=yes, and part of a proper bike relation
# http://www.openstreetmap.org/way/44422697
# http://www.openstreetmap.org/relation/325779
assert_has_feature(
10, 164, 396, 'roads',
{ 'kind': 'path', 'is_bicycle_related': True, 'bicycle_network': 'rcn' })

# Hyltebjerg Allé residential road with rcn in Copenhagen
# https://www.openstreetmap.org/way/2860759
# https://www.openstreetmap.org/relation/2087590
assert_has_feature(
10, 547, 320, 'roads',
{ 'kind': 'minor_road', 'is_bicycle_related': True, 'bicycle_network': 'rcn' })

# lcn in Seattle (living street that would only be visible at zoom 13 otherwise) at zoom 11
# https://www.openstreetmap.org/way/6477775
# https://www.openstreetmap.org/relation/3541926
assert_has_feature(
11, 327, 715, 'roads',
{ 'kind': 'minor_road', 'bicycle_network': 'lcn' })

# Kirkham Street lcn in San Francisco at zoom 11
# https://www.openstreetmap.org/way/89802424
# https://www.openstreetmap.org/relation/32313
assert_has_feature(
11, 327, 791, 'roads',
{ 'kind': 'minor_road', 'bicycle_network': 'lcn' })

# Asiatisk Plads service road with lcn in Copenhagen
# https://www.openstreetmap.org/way/164049387
# https://www.openstreetmap.org/relation/6199242
assert_has_feature(
11, 1095, 641, 'roads',
{ 'kind': 'minor_road', 'bicycle_network': 'lcn' })
7 changes: 4 additions & 3 deletions integration-test/1175-bicycle-route-refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
'all_bicycle_shield_texts': ['45'] })

# make sure the all_* lists are gone by zoom 12 on major roads, but the "most
# important" network & shield text remain until.
# important", singular network & shield text remain at earlier zooms
assert_has_feature(
10, 163, 395, 'roads',
{ 'bicycle_network': 'lcn',
'bicycle_shield_text': '45' })

assert_no_matching_feature(
10, 163, 395, 'roads',
12, 655, 1583, 'roads',
{ 'all_bicycle_networks': None })
assert_no_matching_feature(
10, 163, 395, 'roads',
12, 655, 1583, 'roads',
{ 'all_bicycle_shield_texts': None })
7 changes: 4 additions & 3 deletions integration-test/1194-bus-route-refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@
'all_bus_shield_texts': ['3', '3'] })

# make sure the all_* lists are gone by zoom 12 on major roads, but the "most
# important" network & shield text remain until.
# important", singular network & shield text remain at earlier zooms
#
# note that it doesn't matter what the bus shield is - that's data-dependent.
# for the purposes of the test, we only care that there _is_ one.
assert_has_feature(
10, 163, 395, 'roads',
{ 'bus_network': type(None),
'bus_shield_text': None })

assert_no_matching_feature(
10, 163, 395, 'roads',
12, 654, 1583, 'roads',
{ 'all_bus_networks': None })
assert_no_matching_feature(
10, 163, 395, 'roads',
12, 654, 1583, 'roads',
{ 'all_bus_shield_texts': None })
47 changes: 26 additions & 21 deletions integration-test/593-early-path.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
tiles = [
# highway=path, with route national (Pacific Crest Trail)
# https://www.openstreetmap.org/way/236361475
# https://www.openstreetmap.org/relation/1225378
[11, 345, 790],
# highway=path, with route regional (Merced Pass Trail)
# https://www.openstreetmap.org/way/373491941
# https://www.openstreetmap.org/relation/5549623
[12, 687, 1584],
# highway=path, with route regional (Merced Pass Trail)
# https://www.openstreetmap.org/way/39996451
# https://www.openstreetmap.org/relation/5549623
[12, 688, 1584],
# highway=path, no route, but has name (Upper Yosemite Falls Trail)
# https://www.openstreetmap.org/way/162322353
[13, 1374, 3166]
]
# highway=path, with route national (Pacific Crest Trail)
# https://www.openstreetmap.org/way/236361475
# https://www.openstreetmap.org/relation/1225378
assert_has_feature(
11, 345, 790, 'roads',
{ 'walking_network': 'nwn',
'walking_shield_text': 'PCT' })

for z, x, y in tiles:
assert_has_feature(
z, x, y, 'roads',
{'kind_detail': 'path', 'name': None})
# highway=path, with route regional (Merced Pass Trail)
# https://www.openstreetmap.org/way/373491941
# https://www.openstreetmap.org/relation/5549623
assert_has_feature(
12, 687, 1584, 'roads',
{'kind_detail': 'path', 'name': None, 'walking_network': None})

# highway=path, with route regional (Merced Pass Trail)
# https://www.openstreetmap.org/way/39996451
# https://www.openstreetmap.org/relation/5549623
assert_has_feature(
12, 688, 1584, 'roads',
{'kind_detail': 'path', 'name': None, 'walking_network': None})

# highway=path, no route, but has name (Upper Yosemite Falls Trail)
# https://www.openstreetmap.org/way/162322353
assert_has_feature(
13, 1374, 3166, 'roads',
{'kind_detail': 'path', 'name': None})
107 changes: 78 additions & 29 deletions queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -502,45 +502,89 @@ post_process:
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
properties: [oneway, crossing, sidewalk, sidewalk_left, sidewalk_right, surface]
end_zoom: 12
properties:
- bicycle
- colour
- foot
- operator
- route # NVK (2017425): this is a suspicious tag
- route_name # NVK (2017425): this is a suspicious tag
- sac_scale
- state
- surface
- 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
end_zoom: 13
properties:
- name
- ref
- network
- shield_text
- all_networks
- all_shield_texts
- bicycle_network
- bicycle_shield_text
- all_bicycle_networks
- all_bicycle_shield_texts
- all_walking_networks
- all_walking_shield_texts
- bus_network
- bus_shield_text
- all_bus_networks
- all_bus_shield_texts
# drop certain road properties at lower zooms
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 14
properties:
- ascent
- crossing
- descent
- description
- distance
- horse
- incline
- motor_vehicle
- oneway
- oneway_bicycle
- ramp
- ramp_bicycle
- roundtrip
- segregated
- sidewalk
- sidewalk_left
- sidewalk_right
- sport
- surface
- 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: 11
properties:
- name
- ref
where: >-
(kind == 'rail' and zoom < 15) or
(kind == 'minor_road' and zoom < 14) or
(kind == 'major_road' and zoom < 7)
# previous tests assume we keep walking network information until zoom 11
kind == 'path'
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 10
end_zoom: 14
properties:
- walking_network
- walking_shield_text
- name
- ref
- network
- shield_text
- all_networks
- all_shield_texts
- bus_network
- bus_shield_text
where: >-
(kind == 'rail') or (kind == 'minor_road') or
(kind == 'rail' and zoom < 15) or
(kind == 'minor_road' and zoom < 14) or
(kind == 'major_road' and zoom < 7)
# this is a patch because we still want to drop name, network from major_road
# features between zoom 7 and 10
Expand All @@ -553,12 +597,6 @@ post_process:
- name
- all_networks
- all_shield_texts
- all_bicycle_networks
- all_bicycle_shield_texts
- all_walking_networks
- all_walking_shield_texts
- all_bus_networks
- all_bus_shield_texts
where: >-
kind == 'major_road'
# this is a patch to get rid of name, but keep ref & network, for highways
Expand All @@ -585,6 +623,8 @@ post_process:
- all_shield_texts
- walking_network
- walking_shield_text
- bicycle_network
- bicycle_shield_text
where: >-
kind == 'highway'
# drop non-road shield stuff a good deal earlier.
Expand All @@ -594,8 +634,6 @@ post_process:
start_zoom: 0
end_zoom: 10
properties:
- bicycle_network
- bicycle_shield_text
- all_bicycle_networks
- all_bicycle_shield_texts
- all_walking_networks
Expand All @@ -606,6 +644,17 @@ post_process:
- all_bus_shield_texts
where: >-
kind == 'highway'
# drop walking network related properties on all roads early
# as paths are only brought in at zoom 9 and these properties
# on other kinds would prevent merging at zoom 8 and earlier
- fn: vectordatasource.transform.drop_properties
params:
source_layer: roads
start_zoom: 0
end_zoom: 8
properties:
- walking_network
- walking_shield_text
- fn: vectordatasource.transform.update_parenthetical_properties
params:
source_layer: pois
Expand Down