adding brunnel into z<9 (#1038)
Following https://github.com/openmaptiles/openmaptiles/pull/1027, solving https://github.com/openmaptiles/openmaptiles/issues/999. Adding brunnel attributes to merge tables of `transportation` layer, now it is possible to style/filter tunnels, bridges and fords in all zoom levels. Tested on Switzerland and Europe. Changes in generation speed and filesize minimal.
This commit is contained in:
parent
4a1b0afa26
commit
0aa6648bd9
@ -74,9 +74,9 @@ FROM (
|
|||||||
NULL AS shipway,
|
NULL AS shipway,
|
||||||
NULL AS public_transport,
|
NULL AS public_transport,
|
||||||
NULL AS service,
|
NULL AS service,
|
||||||
NULL::boolean AS is_bridge,
|
is_bridge,
|
||||||
NULL::boolean AS is_tunnel,
|
is_tunnel,
|
||||||
NULL::boolean AS is_ford,
|
is_ford,
|
||||||
NULL::boolean AS is_ramp,
|
NULL::boolean AS is_ramp,
|
||||||
NULL::int AS is_oneway,
|
NULL::int AS is_oneway,
|
||||||
NULL AS man_made,
|
NULL AS man_made,
|
||||||
@ -103,9 +103,9 @@ FROM (
|
|||||||
NULL AS shipway,
|
NULL AS shipway,
|
||||||
NULL AS public_transport,
|
NULL AS public_transport,
|
||||||
NULL AS service,
|
NULL AS service,
|
||||||
NULL::boolean AS is_bridge,
|
is_bridge,
|
||||||
NULL::boolean AS is_tunnel,
|
is_tunnel,
|
||||||
NULL::boolean AS is_ford,
|
is_ford,
|
||||||
NULL::boolean AS is_ramp,
|
NULL::boolean AS is_ramp,
|
||||||
NULL::int AS is_oneway,
|
NULL::int AS is_oneway,
|
||||||
NULL AS man_made,
|
NULL AS man_made,
|
||||||
@ -132,9 +132,9 @@ FROM (
|
|||||||
NULL AS shipway,
|
NULL AS shipway,
|
||||||
NULL AS public_transport,
|
NULL AS public_transport,
|
||||||
NULL AS service,
|
NULL AS service,
|
||||||
NULL::boolean AS is_bridge,
|
is_bridge,
|
||||||
NULL::boolean AS is_tunnel,
|
is_tunnel,
|
||||||
NULL::boolean AS is_ford,
|
is_ford,
|
||||||
NULL::boolean AS is_ramp,
|
NULL::boolean AS is_ramp,
|
||||||
NULL::int AS is_oneway,
|
NULL::int AS is_oneway,
|
||||||
NULL AS man_made,
|
NULL AS man_made,
|
||||||
@ -161,9 +161,9 @@ FROM (
|
|||||||
NULL AS shipway,
|
NULL AS shipway,
|
||||||
NULL AS public_transport,
|
NULL AS public_transport,
|
||||||
NULL AS service,
|
NULL AS service,
|
||||||
NULL::boolean AS is_bridge,
|
is_bridge,
|
||||||
NULL::boolean AS is_tunnel,
|
is_tunnel,
|
||||||
NULL::boolean AS is_ford,
|
is_ford,
|
||||||
NULL::boolean AS is_ramp,
|
NULL::boolean AS is_ramp,
|
||||||
NULL::int AS is_oneway,
|
NULL::int AS is_oneway,
|
||||||
NULL AS man_made,
|
NULL AS man_made,
|
||||||
@ -190,9 +190,9 @@ FROM (
|
|||||||
NULL AS shipway,
|
NULL AS shipway,
|
||||||
NULL AS public_transport,
|
NULL AS public_transport,
|
||||||
NULL AS service,
|
NULL AS service,
|
||||||
NULL::boolean AS is_bridge,
|
is_bridge,
|
||||||
NULL::boolean AS is_tunnel,
|
is_tunnel,
|
||||||
NULL::boolean AS is_ford,
|
is_ford,
|
||||||
NULL::boolean AS is_ramp,
|
NULL::boolean AS is_ramp,
|
||||||
NULL::int AS is_oneway,
|
NULL::int AS is_oneway,
|
||||||
NULL AS man_made,
|
NULL AS man_made,
|
||||||
|
|||||||
@ -27,17 +27,23 @@ SELECT (ST_Dump(geometry)).geom AS geometry,
|
|||||||
NULL::bigint AS osm_id,
|
NULL::bigint AS osm_id,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
construction,
|
||||||
|
is_bridge,
|
||||||
|
is_tunnel,
|
||||||
|
is_ford,
|
||||||
z_order
|
z_order
|
||||||
FROM (
|
FROM (
|
||||||
SELECT ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
SELECT ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
||||||
highway,
|
highway,
|
||||||
construction,
|
construction,
|
||||||
|
is_bridge,
|
||||||
|
is_tunnel,
|
||||||
|
is_ford,
|
||||||
min(z_order) AS z_order
|
min(z_order) AS z_order
|
||||||
FROM osm_highway_linestring
|
FROM osm_highway_linestring
|
||||||
WHERE (highway IN ('motorway', 'trunk', 'primary') OR
|
WHERE (highway IN ('motorway', 'trunk', 'primary') OR
|
||||||
highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary'))
|
highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary'))
|
||||||
AND ST_IsValid(geometry)
|
AND ST_IsValid(geometry)
|
||||||
GROUP BY highway, construction
|
GROUP BY highway, construction, is_bridge, is_tunnel, is_ford
|
||||||
) AS highway_union
|
) AS highway_union
|
||||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx
|
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx
|
||||||
@ -49,7 +55,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_highway_partial_i
|
|||||||
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen3
|
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen3
|
||||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen3 AS
|
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen3 AS
|
||||||
(
|
(
|
||||||
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, highway, construction, z_order
|
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, highway, construction, is_bridge, is_tunnel, is_ford, z_order
|
||||||
FROM osm_transportation_merge_linestring
|
FROM osm_transportation_merge_linestring
|
||||||
WHERE highway IN ('motorway', 'trunk', 'primary')
|
WHERE highway IN ('motorway', 'trunk', 'primary')
|
||||||
OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary')
|
OR highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary')
|
||||||
@ -63,7 +69,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen3_highway_part
|
|||||||
-- etldoc: osm_transportation_merge_linestring_gen3 -> osm_transportation_merge_linestring_gen4
|
-- etldoc: osm_transportation_merge_linestring_gen3 -> osm_transportation_merge_linestring_gen4
|
||||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen4 AS
|
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen4 AS
|
||||||
(
|
(
|
||||||
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, highway, construction, z_order
|
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, highway, construction, is_bridge, is_tunnel, is_ford, z_order
|
||||||
FROM osm_transportation_merge_linestring_gen3
|
FROM osm_transportation_merge_linestring_gen3
|
||||||
WHERE (highway IN ('motorway', 'trunk', 'primary') OR
|
WHERE (highway IN ('motorway', 'trunk', 'primary') OR
|
||||||
highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary'))
|
highway = 'construction' AND construction IN ('motorway', 'trunk', 'primary'))
|
||||||
@ -78,7 +84,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen4_highway_part
|
|||||||
-- etldoc: osm_transportation_merge_linestring_gen4 -> osm_transportation_merge_linestring_gen5
|
-- etldoc: osm_transportation_merge_linestring_gen4 -> osm_transportation_merge_linestring_gen5
|
||||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS
|
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen5 AS
|
||||||
(
|
(
|
||||||
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, construction, z_order
|
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, construction, is_bridge, is_tunnel, is_ford, z_order
|
||||||
FROM osm_transportation_merge_linestring_gen4
|
FROM osm_transportation_merge_linestring_gen4
|
||||||
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND construction IN ('motorway', 'trunk'))
|
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND construction IN ('motorway', 'trunk'))
|
||||||
AND ST_Length(geometry) > 100
|
AND ST_Length(geometry) > 100
|
||||||
@ -92,7 +98,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen5_highway_part
|
|||||||
-- etldoc: osm_transportation_merge_linestring_gen5 -> osm_transportation_merge_linestring_gen6
|
-- etldoc: osm_transportation_merge_linestring_gen5 -> osm_transportation_merge_linestring_gen6
|
||||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen6 AS
|
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen6 AS
|
||||||
(
|
(
|
||||||
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, construction, z_order
|
SELECT ST_Simplify(geometry, 1000) AS geometry, osm_id, highway, construction, is_bridge, is_tunnel, is_ford, z_order
|
||||||
FROM osm_transportation_merge_linestring_gen5
|
FROM osm_transportation_merge_linestring_gen5
|
||||||
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND construction IN ('motorway', 'trunk'))
|
WHERE (highway IN ('motorway', 'trunk') OR highway = 'construction' AND construction IN ('motorway', 'trunk'))
|
||||||
AND ST_Length(geometry) > 500
|
AND ST_Length(geometry) > 500
|
||||||
@ -106,7 +112,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen6_highway_part
|
|||||||
-- etldoc: osm_transportation_merge_linestring_gen6 -> osm_transportation_merge_linestring_gen7
|
-- etldoc: osm_transportation_merge_linestring_gen6 -> osm_transportation_merge_linestring_gen7
|
||||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen7 AS
|
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen7 AS
|
||||||
(
|
(
|
||||||
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, construction, z_order
|
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, construction, is_bridge, is_tunnel, is_ford, z_order
|
||||||
FROM osm_transportation_merge_linestring_gen6
|
FROM osm_transportation_merge_linestring_gen6
|
||||||
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway')
|
WHERE (highway = 'motorway' OR highway = 'construction' AND construction = 'motorway')
|
||||||
AND ST_Length(geometry) > 1000
|
AND ST_Length(geometry) > 1000
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user