kopia lustrzana https://github.com/openmaptiles/openmaptiles
Remove unused osm_transportation_merge_linestring table (#1171)
PR #1168 removed several `WHERE` clauses in the `transportation_merge_*` table series. With those removed, it appears that `osm_transportation_merge_linestring_gen_z8` and `osm_transportation_merge_linestring` are nearly identical, with the former simply adding an `ST_Simplify()` operation. A grep of the codebase indicates that the _only_ use for `osm_transportation_merge_linestring` is to hold the intermediate result of an `ST_Dump(geometry))` before it is fed into `ST_Simplify()`. Therefore, it appears that we're holding an entire zoom 8 copy of the transportation layer (all motorway/trunk/primary roads) in a materialized view for absolutely no reason at all. This PR removes the `osm_transportation_merge_linestring` intermediate table and changes the definition of `osm_transportation_merge_linestring_gen_z8` to perform the `ST_Dump()` and `ST_Simplify()` transformations directly from the `osm_highway_linestring` table in a single operation.pull/1174/head
rodzic
09078f6d7d
commit
f78d42ec84
Plik binarny nie jest wyświetlany.
Przed Szerokość: | Wysokość: | Rozmiar: 556 KiB Po Szerokość: | Wysokość: | Rozmiar: 529 KiB |
|
@ -102,11 +102,11 @@ WHERE highway NOT IN ('tertiary', 'tertiary_link')
|
|||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z9_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen_z9 USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_merge_linestring
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_transportation_merge_linestring CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring AS
|
||||
-- etldoc: osm_highway_linestring -> osm_transportation_merge_linestring_gen_z8
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_transportation_merge_linestring_gen_z8 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z8 AS
|
||||
(
|
||||
SELECT (ST_Dump(geometry)).geom AS geometry,
|
||||
SELECT ST_Simplify((ST_Dump(geometry)).geom, ZRes(10)) AS geometry,
|
||||
NULL::bigint AS osm_id,
|
||||
highway,
|
||||
network,
|
||||
|
@ -131,25 +131,6 @@ FROM (
|
|||
GROUP BY highway, network, construction, is_bridge, is_tunnel, is_ford
|
||||
) AS highway_union
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_geometry_idx
|
||||
ON osm_transportation_merge_linestring USING gist (geometry);
|
||||
|
||||
-- etldoc: osm_transportation_merge_linestring -> osm_transportation_merge_linestring_gen_z8
|
||||
DROP MATERIALIZED VIEW IF EXISTS osm_transportation_merge_linestring_gen_z8 CASCADE;
|
||||
CREATE MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z8 AS
|
||||
(
|
||||
SELECT ST_Simplify(geometry, ZRes(10)) AS geometry,
|
||||
osm_id,
|
||||
highway,
|
||||
network,
|
||||
construction,
|
||||
is_bridge,
|
||||
is_tunnel,
|
||||
is_ford,
|
||||
z_order
|
||||
FROM osm_transportation_merge_linestring
|
||||
-- Current view: motorway/trunk/primary
|
||||
) /* DELAY_MATERIALIZED_VIEW_CREATION */;
|
||||
CREATE INDEX IF NOT EXISTS osm_transportation_merge_linestring_gen_z8_geometry_idx
|
||||
ON osm_transportation_merge_linestring_gen_z8 USING gist (geometry);
|
||||
|
||||
|
@ -258,7 +239,6 @@ DECLARE
|
|||
t TIMESTAMP WITH TIME ZONE := clock_timestamp();
|
||||
BEGIN
|
||||
RAISE LOG 'Refresh transportation';
|
||||
REFRESH MATERIALIZED VIEW osm_transportation_merge_linestring;
|
||||
REFRESH MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z8;
|
||||
REFRESH MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z7;
|
||||
REFRESH MATERIALIZED VIEW osm_transportation_merge_linestring_gen_z6;
|
||||
|
|
Ładowanie…
Reference in New Issue