Add expressway tagging to the transportation layer (#1313)
Fixes #1148 This PR adds expressway tagging to the `transportation` layer, by setting `expressway=1` for non-motorway roads tagged `expressway=yes`, and omitting the tag otherwise. Additionally, I've added a few unit tests to verify that the expressway tagging is being imported and updated into the intermediate tables. Here is an example of expressway tagging on US-1 in Rhode Island, USA: 
This commit is contained in:
committed by
GitHub
parent
ec74480414
commit
7f23feab88
@@ -159,6 +159,10 @@ surface_field: &surface
|
||||
key: surface
|
||||
name: surface
|
||||
type: string
|
||||
expressway_field: &expressway
|
||||
key: expressway
|
||||
name: expressway
|
||||
type: bool
|
||||
|
||||
tables:
|
||||
# etldoc: imposm3 -> osm_highway_linestring
|
||||
@@ -206,6 +210,7 @@ tables:
|
||||
- *mtb_scale
|
||||
- *sac_scale
|
||||
- *surface
|
||||
- *expressway
|
||||
mapping:
|
||||
highway:
|
||||
- motorway
|
||||
|
||||
@@ -11,25 +11,26 @@ $$ LANGUAGE SQL IMMUTABLE
|
||||
CREATE OR REPLACE FUNCTION layer_transportation(bbox geometry, zoom_level int)
|
||||
RETURNS TABLE
|
||||
(
|
||||
osm_id bigint,
|
||||
geometry geometry,
|
||||
class text,
|
||||
subclass text,
|
||||
network text,
|
||||
ramp int,
|
||||
oneway int,
|
||||
brunnel text,
|
||||
service text,
|
||||
access text,
|
||||
toll int,
|
||||
layer int,
|
||||
level int,
|
||||
indoor int,
|
||||
bicycle text,
|
||||
foot text,
|
||||
horse text,
|
||||
mtb_scale text,
|
||||
surface text
|
||||
osm_id bigint,
|
||||
geometry geometry,
|
||||
class text,
|
||||
subclass text,
|
||||
network text,
|
||||
ramp int,
|
||||
oneway int,
|
||||
brunnel text,
|
||||
service text,
|
||||
access text,
|
||||
toll int,
|
||||
expressway int,
|
||||
layer int,
|
||||
level int,
|
||||
indoor int,
|
||||
bicycle text,
|
||||
foot text,
|
||||
horse text,
|
||||
mtb_scale text,
|
||||
surface text
|
||||
)
|
||||
AS
|
||||
$$
|
||||
@@ -61,6 +62,7 @@ SELECT osm_id,
|
||||
NULLIF(service, '') AS service,
|
||||
access,
|
||||
CASE WHEN toll = TRUE THEN 1 END AS toll,
|
||||
CASE WHEN highway NOT IN ('', 'motorway') AND expressway = TRUE THEN 1 END AS expressway,
|
||||
NULLIF(layer, 0) AS layer,
|
||||
"level",
|
||||
CASE WHEN indoor = TRUE THEN 1 END AS indoor,
|
||||
@@ -86,6 +88,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -118,6 +121,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -150,6 +154,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -182,6 +187,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -214,6 +220,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -246,6 +253,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -278,6 +286,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -310,6 +319,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -347,6 +357,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
man_made,
|
||||
@@ -399,6 +410,7 @@ FROM (
|
||||
NULL::boolean AS is_bridge,
|
||||
NULL::boolean AS is_tunnel,
|
||||
NULL::boolean AS is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -434,6 +446,7 @@ FROM (
|
||||
NULL::boolean AS is_bridge,
|
||||
NULL::boolean AS is_tunnel,
|
||||
NULL::boolean AS is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
NULL::boolean AS is_ramp,
|
||||
NULL::int AS is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -469,6 +482,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -503,6 +517,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -537,6 +552,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -572,6 +588,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -607,6 +624,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -640,6 +658,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -672,6 +691,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -704,6 +724,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -737,6 +758,7 @@ FROM (
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
is_ramp,
|
||||
is_oneway,
|
||||
NULL AS man_made,
|
||||
@@ -777,6 +799,7 @@ FROM (
|
||||
END AS is_bridge,
|
||||
FALSE AS is_tunnel,
|
||||
FALSE AS is_ford,
|
||||
NULL::boolean AS expressway,
|
||||
FALSE AS is_ramp,
|
||||
FALSE::int AS is_oneway,
|
||||
man_made,
|
||||
|
||||
@@ -162,6 +162,10 @@ layer:
|
||||
description: |
|
||||
Whether this is a toll road, based on the [`toll`](http://wiki.openstreetmap.org/wiki/Key:toll) tag.
|
||||
values: [0, 1]
|
||||
expressway:
|
||||
description: |
|
||||
Whether this is an expressway, based on the [`expressway`](http://wiki.openstreetmap.org/wiki/Key:expressway) tag.
|
||||
values: [1]
|
||||
layer:
|
||||
description: |
|
||||
Original value of the [`layer`](http://wiki.openstreetmap.org/wiki/Key:layer) tag.
|
||||
@@ -196,7 +200,7 @@ layer:
|
||||
datasource:
|
||||
geometry_field: geometry
|
||||
srid: 900913
|
||||
query: (SELECT geometry, class, subclass, network, oneway, ramp, brunnel, service, access, toll, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
|
||||
query: (SELECT geometry, class, subclass, network, oneway, ramp, brunnel, service, access, toll, expressway, layer, level, indoor, bicycle, foot, horse, mtb_scale, surface FROM layer_transportation(!bbox!, z(!scale_denominator!))) AS t
|
||||
schema:
|
||||
- ./network_type.sql
|
||||
- ./class.sql
|
||||
|
||||
@@ -82,6 +82,7 @@ SELECT (ST_Dump(ST_LineMerge(ST_Collect(geometry)))).geom AS geometry,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
min(z_order) as z_order,
|
||||
bicycle,
|
||||
foot,
|
||||
@@ -95,7 +96,7 @@ SELECT (ST_Dump(ST_LineMerge(ST_Collect(geometry)))).geom AS geometry,
|
||||
layer
|
||||
FROM osm_highway_linestring_gen_z11
|
||||
-- mapping.yaml pre-filter: motorway/trunk/primary/secondary/tertiary, with _link variants, construction, ST_IsValid()
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, bicycle, foot, horse, mtb_scale, sac_scale, access, toll, layer
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, expressway, bicycle, foot, horse, mtb_scale, sac_scale, access, toll, layer
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z11_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen_z11 USING gist (geometry);
|
||||
@@ -111,6 +112,7 @@ SELECT ST_Simplify(geometry, ZRes(12)) AS geometry,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
z_order,
|
||||
bicycle,
|
||||
foot,
|
||||
@@ -138,6 +140,7 @@ SELECT ST_Simplify(geometry, ZRes(11)) AS geometry,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
z_order,
|
||||
bicycle,
|
||||
foot,
|
||||
@@ -164,13 +167,14 @@ SELECT ST_Simplify(ST_LineMerge(ST_Collect(geometry)), ZRes(10)) AS geometry,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
min(z_order) as z_order
|
||||
FROM osm_transportation_merge_linestring_gen_z9
|
||||
WHERE (highway IN ('motorway', 'trunk', 'primary') OR
|
||||
construction IN ('motorway', 'trunk', 'primary'))
|
||||
AND ST_IsValid(geometry)
|
||||
AND access IS NULL
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford
|
||||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford, expressway
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z8_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen_z8 USING gist (geometry);
|
||||
@@ -186,6 +190,7 @@ SELECT ST_Simplify(geometry, ZRes(9)) AS geometry,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
expressway,
|
||||
z_order
|
||||
FROM osm_transportation_merge_linestring_gen_z8
|
||||
-- Current view: motorway/trunk/primary
|
||||
|
||||
Reference in New Issue
Block a user