Remove memeber_osm_ids attribute from transportation and transportation_name
Too big DB during import-sql step
This commit is contained in:
parent
a322851274
commit
c6eed77e42
@ -26,18 +26,14 @@ CREATE INDEX IF NOT EXISTS osm_highway_linestring_highway_partial_idx
|
|||||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
|
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS (
|
||||||
SELECT
|
SELECT
|
||||||
(ST_Dump(geometry)).geom AS geometry,
|
(ST_Dump(geometry)).geom AS geometry,
|
||||||
-- NOTE: The osm_id is no longer the original one which can make it difficult
|
NULL::bigint AS osm_id,
|
||||||
-- to lookup road names by OSM ID
|
|
||||||
member_osm_ids[1] AS osm_id,
|
|
||||||
member_osm_ids,
|
|
||||||
highway,
|
highway,
|
||||||
z_order
|
z_order
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
ST_LineMerge(ST_Collect(geometry)) AS geometry,
|
||||||
highway,
|
highway,
|
||||||
min(z_order) AS z_order,
|
min(z_order) AS z_order
|
||||||
array_agg(DISTINCT osm_id) AS member_osm_ids
|
|
||||||
FROM osm_highway_linestring
|
FROM osm_highway_linestring
|
||||||
WHERE highway IN ('motorway','trunk')
|
WHERE highway IN ('motorway','trunk')
|
||||||
group by highway
|
group by highway
|
||||||
@ -51,7 +47,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_highway_partial_i
|
|||||||
|
|
||||||
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen5
|
-- etldoc: osm_transportation_merge_linestring -> 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, member_osm_ids, highway, z_order
|
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, highway, z_order
|
||||||
FROM osm_transportation_merge_linestring
|
FROM osm_transportation_merge_linestring
|
||||||
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 20000
|
WHERE highway IN ('motorway','trunk') AND ST_Length(geometry) > 20000
|
||||||
);
|
);
|
||||||
@ -63,7 +59,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, 2000) AS geometry, osm_id, member_osm_ids, highway, z_order
|
SELECT ST_Simplify(geometry, 2000) AS geometry, osm_id, highway, z_order
|
||||||
FROM osm_transportation_merge_linestring_gen5
|
FROM osm_transportation_merge_linestring_gen5
|
||||||
WHERE highway IN ('motorway') AND ST_Length(geometry) > 20000
|
WHERE highway IN ('motorway') AND ST_Length(geometry) > 20000
|
||||||
);
|
);
|
||||||
|
|||||||
@ -36,10 +36,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_network_geometry_idx ON osm_t
|
|||||||
CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
|
CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
|
||||||
SELECT
|
SELECT
|
||||||
(ST_Dump(geometry)).geom AS geometry,
|
(ST_Dump(geometry)).geom AS geometry,
|
||||||
-- NOTE: The osm_id is no longer the original one which can make it difficult
|
NULL::bigint AS osm_id,
|
||||||
-- to lookup road names by OSM ID
|
|
||||||
member_osm_ids[1] AS osm_id,
|
|
||||||
member_osm_ids,
|
|
||||||
name,
|
name,
|
||||||
name_en,
|
name_en,
|
||||||
name_de,
|
name_de,
|
||||||
@ -56,8 +53,7 @@ CREATE MATERIALIZED VIEW osm_transportation_name_linestring AS (
|
|||||||
ref,
|
ref,
|
||||||
highway,
|
highway,
|
||||||
network_type,
|
network_type,
|
||||||
min(z_order) AS z_order,
|
min(z_order) AS z_order
|
||||||
array_agg(DISTINCT osm_id) AS member_osm_ids
|
|
||||||
FROM osm_transportation_name_network
|
FROM osm_transportation_name_network
|
||||||
WHERE ("rank"=1 OR "rank" is null)
|
WHERE ("rank"=1 OR "rank" is null)
|
||||||
AND (name <> '' OR ref <> '')
|
AND (name <> '' OR ref <> '')
|
||||||
@ -73,7 +69,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_highway_partial_id
|
|||||||
|
|
||||||
-- 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, member_osm_ids, name, name_en, name_de, ref, highway, network, z_order
|
SELECT ST_Simplify(geometry, 50) AS geometry, osm_id, name, name_en, name_de, ref, highway, 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') AND ST_Length(geometry) > 8000
|
||||||
);
|
);
|
||||||
@ -85,7 +81,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen1_highway_parti
|
|||||||
|
|
||||||
-- 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, member_osm_ids, name, name_en, name_de, ref, highway, network, z_order
|
SELECT ST_Simplify(geometry, 120) AS geometry, osm_id, name, name_en, name_de, ref, highway, 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') AND ST_Length(geometry) > 14000
|
||||||
);
|
);
|
||||||
@ -97,7 +93,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen2_highway_parti
|
|||||||
|
|
||||||
-- 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, member_osm_ids, name, name_en, name_de, ref, highway, network, z_order
|
SELECT ST_Simplify(geometry, 200) AS geometry, osm_id, name, name_en, name_de, ref, highway, 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' AND ST_Length(geometry) > 20000
|
||||||
);
|
);
|
||||||
@ -109,7 +105,7 @@ CREATE INDEX IF NOT EXISTS osm_transportation_name_linestring_gen3_highway_parti
|
|||||||
|
|
||||||
-- 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, member_osm_ids, name, name_en, name_de, ref, highway, network, z_order
|
SELECT ST_Simplify(geometry, 500) AS geometry, osm_id, name, name_en, name_de, ref, highway, 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' AND ST_Length(geometry) > 20000
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user