layers/transportation/: differentiate roads under construction (#321)

This commit is contained in:
golubev
2019-10-04 13:08:49 +03:00
parent 45a50a5bd0
commit 0636466cfd
4 changed files with 63 additions and 45 deletions

View File

@@ -9,7 +9,7 @@ $$ LANGUAGE SQL IMMUTABLE STRICT;
-- The classes for highways are derived from the classes used in ClearTables
-- https://github.com/ClearTables/ClearTables/blob/master/transportation.lua
CREATE OR REPLACE FUNCTION highway_class(highway TEXT, public_transport TEXT) RETURNS TEXT AS $$
CREATE OR REPLACE FUNCTION highway_class(highway TEXT, public_transport TEXT, construction TEXT) RETURNS TEXT AS $$
SELECT CASE
WHEN highway IN ('motorway', 'motorway_link') THEN 'motorway'
WHEN highway IN ('trunk', 'trunk_link') THEN 'trunk'
@@ -18,7 +18,18 @@ CREATE OR REPLACE FUNCTION highway_class(highway TEXT, public_transport TEXT) RE
WHEN highway IN ('tertiary', 'tertiary_link') THEN 'tertiary'
WHEN highway IN ('unclassified', 'residential', 'living_street', 'road') THEN 'minor'
WHEN highway IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor') OR public_transport IN ('platform') THEN 'path'
WHEN highway IN ('service', 'track', 'raceway', 'construction') THEN highway
WHEN highway IN ('service', 'track', 'raceway') THEN highway
WHEN highway = 'construction' THEN CASE
WHEN construction IN ('motorway', 'motorway_link') THEN 'motorway_construction'
WHEN construction IN ('trunk', 'trunk_link') THEN 'trunk_construction'
WHEN construction IN ('primary', 'primary_link') THEN 'primary_construction'
WHEN construction IN ('secondary', 'secondary_link') THEN 'secondary_construction'
WHEN construction IN ('tertiary', 'tertiary_link') THEN 'tertiary_construction'
WHEN construction IS NULL OR construction IN ('unclassified', 'residential', 'living_street', 'road') THEN 'minor_construction'
WHEN construction IN ('pedestrian', 'path', 'footway', 'cycleway', 'steps', 'bridleway', 'corridor') OR public_transport IN ('platform') THEN 'path_construction'
WHEN construction IN ('service', 'track', 'raceway') THEN CONCAT(highway, '_construction')
ELSE NULL
END
ELSE NULL
END;
$$ LANGUAGE SQL IMMUTABLE;