layers/transportation_name/: add roads under construction, fix SQL error (#321)

pull/677/head
golubev 2019-10-04 14:50:05 +03:00
rodzic 81c90be19b
commit 73307a610b
2 zmienionych plików z 27 dodań i 21 usunięć

Wyświetl plik

@ -19,9 +19,9 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
when length(coalesce(ref, ''))>0 when length(coalesce(ref, ''))>0
then 'road' then 'road'
end as network, end as network,
highway_class(highway, '') AS class, highway_class(highway, '', construction) AS class,
CASE CASE
WHEN highway IS NOT NULL AND highway_class(highway, '') = 'path' WHEN highway IS NOT NULL AND highway_class(highway, '', construction) = 'path'
THEN highway THEN highway
ELSE NULL ELSE NULL
END AS subclass, END AS subclass,
@ -70,6 +70,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
"tags", "tags",
ref, ref,
highway, highway,
construction,
network, network,
z_order, z_order,
layer, layer,
@ -78,7 +79,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
FROM osm_transportation_name_linestring FROM osm_transportation_name_linestring
WHERE zoom_level = 12 WHERE zoom_level = 12
AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry) AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry)
AND highway_class(highway, '') NOT IN ('minor', 'track', 'path') AND highway_class(highway, '', construction) NOT IN ('minor', 'track', 'path')
AND NOT highway_is_link(highway) AND NOT highway_is_link(highway)
UNION ALL UNION ALL
@ -92,6 +93,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
"tags", "tags",
ref, ref,
highway, highway,
construction,
network, network,
z_order, z_order,
layer, layer,
@ -100,7 +102,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
FROM osm_transportation_name_linestring FROM osm_transportation_name_linestring
WHERE zoom_level = 13 WHERE zoom_level = 13
AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry) AND LineLabel(zoom_level, COALESCE(NULLIF(name, ''), ref), geometry)
AND highway_class(highway, '') NOT IN ('track', 'path') AND highway_class(highway, '', construction) NOT IN ('track', 'path')
UNION ALL UNION ALL
-- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_ -- etldoc: osm_transportation_name_linestring -> layer_transportation_name:z14_
@ -113,6 +115,7 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text,
"tags", "tags",
ref, ref,
highway, highway,
construction,
network, network,
z_order, z_order,
layer, layer,

Wyświetl plik

@ -24,6 +24,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_network AS (
else hl.ref else hl.ref
end as ref, end as ref,
hl.highway, hl.highway,
hl.construction,
CASE WHEN highway IN ('footway', 'steps') THEN layer CASE WHEN highway IN ('footway', 'steps') THEN layer
ELSE NULL::int ELSE NULL::int
END AS layer, END AS layer,
@ -53,6 +54,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
tags || get_basic_names(tags, geometry) AS "tags", tags || get_basic_names(tags, geometry) AS "tags",
ref, ref,
highway, highway,
construction,
"level", "level",
layer, layer,
indoor, indoor,
@ -68,6 +70,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
AS "tags", AS "tags",
ref, ref,
highway, highway,
construction,
"level", "level",
layer, layer,
indoor, indoor,
@ -77,56 +80,56 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
WHERE ("rank"=1 OR "rank" is null) WHERE ("rank"=1 OR "rank" is null)
AND (name <> '' OR ref <> '') AND (name <> '' OR ref <> '')
AND NULLIF(highway, '') IS NOT NULL AND NULLIF(highway, '') IS NOT NULL
group by name, name_en, name_de, ref, highway, "level", layer, indoor, network_type group by name, name_en, name_de, ref, highway, construction, "level", layer, indoor, network_type
) AS highway_union ) AS highway_union
); );
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry); CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_geometry_idx ON osm_transportation_name_linestring USING gist(geometry);
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_highway_partial_idx CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_highway_partial_idx
ON osm_transportation_name_linestring(highway) ON osm_transportation_name_linestring(highway, construction)
WHERE highway IN ('motorway','trunk'); WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1 -- etldoc: osm_transportation_name_linestring -> osm_transportation_name_linestring_gen1
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen1 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen1 AS (
SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, network, z_order SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
FROM osm_transportation_name_linestring FROM osm_transportation_name_linestring
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 8000 WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 8000
); );
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx ON osm_transportation_name_linestring_gen1 USING gist(geometry); CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_geometry_idx ON osm_transportation_name_linestring_gen1 USING gist(geometry);
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_highway_partial_idx CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_highway_partial_idx
ON osm_transportation_name_linestring_gen1(highway) ON osm_transportation_name_linestring_gen1(highway, construction)
WHERE highway IN ('motorway','trunk'); WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2 -- etldoc: osm_transportation_name_linestring_gen1 -> osm_transportation_name_linestring_gen2
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen2 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen2 AS (
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, network, z_order SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
FROM osm_transportation_name_linestring_gen1 FROM osm_transportation_name_linestring_gen1
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 14000 WHERE (highway IN ('motorway','trunk') OR highway = 'construction' AND construction IN ('motorway','trunk')) AND ST_Length(geometry) > 14000
); );
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx ON osm_transportation_name_linestring_gen2 USING gist(geometry); CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_geometry_idx ON osm_transportation_name_linestring_gen2 USING gist(geometry);
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_highway_partial_idx CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_highway_partial_idx
ON osm_transportation_name_linestring_gen2(highway) ON osm_transportation_name_linestring_gen2(highway, construction)
WHERE highway = 'motorway'; WHERE highway IN ('motorway','trunk', 'construction');
-- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3 -- etldoc: osm_transportation_name_linestring_gen2 -> osm_transportation_name_linestring_gen3
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen3 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen3 AS (
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, network, z_order SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
FROM osm_transportation_name_linestring_gen2 FROM osm_transportation_name_linestring_gen2
WHERE highway = 'motorway' AND ST_Length(geometry) > 20000 WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 20000
); );
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx ON osm_transportation_name_linestring_gen3 USING gist(geometry); CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_geometry_idx ON osm_transportation_name_linestring_gen3 USING gist(geometry);
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_highway_partial_idx CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_highway_partial_idx
ON osm_transportation_name_linestring_gen3(highway) ON osm_transportation_name_linestring_gen3(highway, construction)
WHERE highway = 'motorway'; WHERE highway IN ('motorway', 'construction');
-- etldoc: osm_transportation_name_linestring_gen3 -> osm_transportation_name_linestring_gen4 -- etldoc: osm_transportation_name_linestring_gen3 -> osm_transportation_name_linestring_gen4
CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen4 AS ( CREATE MATERIALIZED VIEW osm_transportation_name_linestring_gen4 AS (
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, network, z_order SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, name, name_en, name_de, tags, ref, highway, construction, network, z_order
FROM osm_transportation_name_linestring_gen3 FROM osm_transportation_name_linestring_gen3
WHERE highway = 'motorway' AND ST_Length(geometry) > 20000 WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway') AND ST_Length(geometry) > 20000
); );
CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen4_geometry_idx ON osm_transportation_name_linestring_gen4 USING gist(geometry); CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen4_geometry_idx ON osm_transportation_name_linestring_gen4 USING gist(geometry);