From 5e9b7c475d53a5bd5ea394da361594d3f4ce2d66 Mon Sep 17 00:00:00 2001 From: Brian Sperlongano Date: Thu, 26 Jan 2023 13:24:44 -0500 Subject: [PATCH] Add grade 1 tracks to paved (#1485) This PR sets `surface=paved` for `highway=track` + `tracktype=grade1` if no other value of `surface` is set. Roads tagged in this way are [generally paved](https://wiki.openstreetmap.org/wiki/Key:tracktype) and therefore encoding them as a paved road is appropriate. --- layers/transportation/class.sql | 2 +- layers/transportation/mapping.yaml | 3 +++ layers/transportation/transportation.sql | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/layers/transportation/class.sql b/layers/transportation/class.sql index c73ce817..00b8c38b 100644 --- a/layers/transportation/class.sql +++ b/layers/transportation/class.sql @@ -48,7 +48,7 @@ CREATE OR REPLACE FUNCTION surface_value(surface text) RETURNS text AS $$ SELECT CASE WHEN surface IN ('paved', 'asphalt', 'cobblestone', 'concrete', 'concrete:lanes', 'concrete:plates', 'metal', - 'paving_stones', 'sett', 'unhewn_cobblestone', 'wood') THEN 'paved' + 'paving_stones', 'sett', 'unhewn_cobblestone', 'wood', 'grade1') THEN 'paved' WHEN surface IN ('unpaved', 'compacted', 'dirt', 'earth', 'fine_gravel', 'grass', 'grass_paver', 'gravel', 'gravel_turf', 'ground', 'ice', 'mud', 'pebblestone', 'salt', 'sand', 'snow', 'woodchips') THEN 'unpaved' diff --git a/layers/transportation/mapping.yaml b/layers/transportation/mapping.yaml index 05a9c0f8..1f01322b 100644 --- a/layers/transportation/mapping.yaml +++ b/layers/transportation/mapping.yaml @@ -180,6 +180,9 @@ tables: - name: construction key: construction type: string + - name: tracktype + key: tracktype + type: string - *ref - *network - *z_order diff --git a/layers/transportation/transportation.sql b/layers/transportation/transportation.sql index 349fe1ca..7a516f65 100644 --- a/layers/transportation/transportation.sql +++ b/layers/transportation/transportation.sql @@ -368,7 +368,7 @@ FROM ( foot, horse, mtb_scale, - surface_value(surface) AS "surface", + surface_value(COALESCE(NULLIF(surface, ''), tracktype)) AS "surface", hl.z_order FROM osm_highway_linestring hl LEFT OUTER JOIN osm_transportation_name_network n ON hl.osm_id = n.osm_id