layers/transportation/: differentiate roads under construction (#321)
This commit is contained in:
@@ -22,14 +22,14 @@ CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_idx
|
||||
-- Improve performance of the sql below
|
||||
CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_partial_idx
|
||||
ON osm_highway_linestring(highway)
|
||||
WHERE highway IN ('motorway','trunk', 'primary');
|
||||
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_merge_linestring
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
|
||||
SELECT
|
||||
(ST_Dump(geometry)).geom AS geometry,
|
||||
NULL::bigint AS osm_id,
|
||||
highway,
|
||||
highway, construction,
|
||||
z_order
|
||||
FROM (
|
||||
SELECT
|
||||
@@ -37,7 +37,8 @@ CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
|
||||
highway,
|
||||
min(z_order) AS z_order
|
||||
FROM osm_highway_linestring
|
||||
WHERE highway IN ('motorway','trunk', 'primary') AND ST_IsValid(geometry)
|
||||
WHERE (highway IN ('motorway','trunk', 'primary') OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary'))
|
||||
AND ST_IsValid(geometry)
|
||||
group by highway
|
||||
) AS highway_union
|
||||
);
|
||||
@@ -45,61 +46,64 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx
|
||||
ON osm_transportation_merge_linestring USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_highway_partial_idx
|
||||
ON osm_transportation_merge_linestring(highway)
|
||||
WHERE highway IN ('motorway','trunk', 'primary');
|
||||
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen3
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen3 AS (
|
||||
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, highway, z_order
|
||||
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring
|
||||
WHERE highway IN ('motorway','trunk', 'primary')
|
||||
OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary')
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen3_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen3 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen3_highway_partial_idx
|
||||
ON osm_transportation_merge_linestring_gen3(highway)
|
||||
WHERE highway IN ('motorway','trunk', 'primary');
|
||||
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring_gen3 -> osm_transportation_merge_linestring_gen4
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen4 AS (
|
||||
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, highway, z_order
|
||||
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring_gen3
|
||||
WHERE highway IN ('motorway','trunk', 'primary') AND ST_Length(geometry) > 50
|
||||
WHERE (highway IN ('motorway','trunk', 'primary') OR highway = 'construction' AND construction IN ('motorway','trunk', 'primary'))
|
||||
AND ST_Length(geometry) > 50
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen4_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen4 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen4_highway_partial_idx
|
||||
ON osm_transportation_merge_linestring_gen4(highway)
|
||||
WHERE highway IN ('motorway','trunk', 'primary');
|
||||
WHERE highway IN ('motorway','trunk', 'primary', 'construction');
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring_gen4 -> osm_transportation_merge_linestring_gen5
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS (
|
||||
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, z_order
|
||||
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring_gen4
|
||||
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 100
|
||||
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk'))
|
||||
AND ST_Length(geometry) > 100
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen5 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_highway_partial_idx
|
||||
ON osm_transportation_merge_linestring_gen5(highway)
|
||||
WHERE highway IN ('motorway', 'trunk');
|
||||
WHERE highway IN ('motorway','trunk', 'construction');
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring_gen5 -> osm_transportation_merge_linestring_gen6
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen6 AS (
|
||||
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, z_order
|
||||
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring_gen5
|
||||
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 500
|
||||
WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 500
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen6_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen6 USING gist(geometry);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen6_highway_partial_idx
|
||||
ON osm_transportation_merge_linestring_gen6(highway)
|
||||
WHERE highway IN ('motorway','trunk');
|
||||
WHERE highway IN ('motorway','trunk', 'construction');
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring_gen6 -> osm_transportation_merge_linestring_gen7
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen7 AS (
|
||||
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, z_order
|
||||
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, construction, z_order
|
||||
FROM osm_transportation_merge_linestring_gen6
|
||||
WHERE highway IN ('motorway') AND ST_Length(geometry) > 1000
|
||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 1000
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen7_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen7 USING gist(geometry);
|
||||
|
||||
Reference in New Issue
Block a user