union ocean regular squares into complex polygon (#1021)

The ocean layer (table osm_ocean_polygon insert by `make import-data`) is made from squares that have a 10m buffer. 

This creates extra geometry in vector tiles as:

Union of full ocean squares should decrease the size of the water layer.

there are 8042 polygons (squares, 5 points, more then 100km<sup>2</sup>), which was reduced to 22 polygons - 1184kB vs 40kB respectively. 

In mbtiles should be the size reduction even more significant, due to the creation of more polygons based on a 10m buffer of each square.
This commit is contained in:
Tomas Pohanka
2020-10-14 13:56:04 +02:00
committed by GitHub
parent 72165933be
commit b7429ce6f5
3 changed files with 38 additions and 14 deletions

View File

@@ -237,13 +237,13 @@ WHERE "natural" != 'bay'
CREATE OR REPLACE VIEW water_z12 AS
(
-- etldoc: osm_ocean_polygon_gen1 -> water_z12
-- etldoc: osm_ocean_polygon_union -> water_z12
SELECT geometry,
'ocean'::text AS class,
NULL::boolean AS is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
FROM osm_ocean_polygon
FROM osm_ocean_polygon_union
UNION ALL
-- etldoc: osm_water_polygon -> water_z12
SELECT geometry,
@@ -257,13 +257,13 @@ WHERE "natural" != 'bay'
CREATE OR REPLACE VIEW water_z13 AS
(
-- etldoc: osm_ocean_polygon -> water_z13
-- etldoc: osm_ocean_polygon_union -> water_z13
SELECT geometry,
'ocean'::text AS class,
NULL::boolean AS is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
FROM osm_ocean_polygon
FROM osm_ocean_polygon_union
UNION ALL
-- etldoc: osm_water_polygon -> water_z13
SELECT geometry,
@@ -277,13 +277,13 @@ WHERE "natural" != 'bay'
CREATE OR REPLACE VIEW water_z14 AS
(
-- etldoc: osm_ocean_polygon -> water_z14
-- etldoc: osm_ocean_polygon_union -> water_z14
SELECT geometry,
'ocean'::text AS class,
NULL::boolean AS is_intermittent,
NULL::boolean AS is_bridge,
NULL::boolean AS is_tunnel
FROM osm_ocean_polygon
FROM osm_ocean_polygon_union
UNION ALL
-- etldoc: osm_water_polygon -> water_z14
SELECT geometry,