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:

![image](https://user-images.githubusercontent.com/3254090/143501278-db3671b2-2efa-4998-bffd-9ddfec63579b.png)
This commit is contained in:
Brian Sperlongano
2021-11-26 01:55:20 -05:00
committed by GitHub
parent ec74480414
commit 7f23feab88
8 changed files with 82 additions and 22 deletions

View File

@@ -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,