From d5f4b8742b9f59866719faf0416e732b02cac06d Mon Sep 17 00:00:00 2001 From: Bertil Chapuis Date: Fri, 27 Oct 2023 21:41:11 +0200 Subject: [PATCH] Move layers in separate directories --- basemap/layers/water/clean.sql | 23 ------ basemap/layers/water/index.sql | 22 ----- basemap/workflow.js | 8 +- daylight/layers/coastline/clean.sql | 22 +++++ daylight/layers/coastline/index.sql | 22 +++++ .../layers/coastline}/overlay.js | 0 .../layers/coastline}/prepare.sql | 2 +- .../layers/coastline}/simplify.sql | 80 +++++++++---------- .../layers/coastline}/tileset.js | 4 +- daylight/tileset.js | 2 +- daylight/workflow.js | 10 +-- 11 files changed, 96 insertions(+), 99 deletions(-) delete mode 100644 basemap/layers/water/clean.sql delete mode 100644 basemap/layers/water/index.sql create mode 100644 daylight/layers/coastline/clean.sql create mode 100644 daylight/layers/coastline/index.sql rename {basemap/layers/water => daylight/layers/coastline}/overlay.js (100%) rename {basemap/layers/water => daylight/layers/coastline}/prepare.sql (94%) rename {basemap/layers/water => daylight/layers/coastline}/simplify.sql (52%) rename {basemap/layers/water => daylight/layers/coastline}/tileset.js (85%) diff --git a/basemap/layers/water/clean.sql b/basemap/layers/water/clean.sql deleted file mode 100644 index 42e42c10b..000000000 --- a/basemap/layers/water/clean.sql +++ /dev/null @@ -1,23 +0,0 @@ --- Licensed under the Apache License, Version 2.0 (the License); you may not use this file except --- in compliance with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software distributed under the License --- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express --- or implied. See the License for the specific language governing permissions and limitations under --- the License. -DROP MATERIALIZED VIEW IF EXISTS osm_water CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z12 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z11 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z10 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z9 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z8 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z7 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z6 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z5 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z4 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z3 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z2 CASCADE; -DROP MATERIALIZED VIEW IF EXISTS osm_water_z1 CASCADE; - diff --git a/basemap/layers/water/index.sql b/basemap/layers/water/index.sql deleted file mode 100644 index cbd35c953..000000000 --- a/basemap/layers/water/index.sql +++ /dev/null @@ -1,22 +0,0 @@ --- Licensed under the Apache License, Version 2.0 (the License); you may not use this file except --- in compliance with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software distributed under the License --- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express --- or implied. See the License for the specific language governing permissions and limitations under --- the License. -CREATE INDEX IF NOT EXISTS osm_water_index ON osm_water USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z12_index ON osm_water_z12 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z11_index ON osm_water_z11 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z10_index ON osm_water_z10 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z9_index ON osm_water_z9 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z8_index ON osm_water_z8 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z7_index ON osm_water_z7 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z6_index ON osm_water_z6 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z5_index ON osm_water_z5 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z4_index ON osm_water_z4 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z3_index ON osm_water_z3 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z2_index ON osm_water_z2 USING SPGIST (geom); -CREATE INDEX IF NOT EXISTS osm_water_z1_index ON osm_water_z1 USING SPGIST (geom); diff --git a/basemap/workflow.js b/basemap/workflow.js index 7bab101d4..be7c2e0fa 100644 --- a/basemap/workflow.js +++ b/basemap/workflow.js @@ -48,7 +48,7 @@ export default { ] }, { - "id": "water-polygons", + "id": "openstreetmap-water-polygons", "needs": [], "tasks": [ { @@ -71,7 +71,7 @@ export default { ] }, { - "id": "simplified-water-polygons", + "id": "openstreetmap-simplified-water-polygons", "needs": [], "tasks": [ { @@ -96,8 +96,8 @@ export default { { "id": "openstreetmap-ocean", "needs": [ - "water-polygons", - "simplified-water-polygons", + "openstreetmap-water-polygons", + "openstreetmap-simplified-water-polygons", ], "tasks": [ { diff --git a/daylight/layers/coastline/clean.sql b/daylight/layers/coastline/clean.sql new file mode 100644 index 000000000..b49165305 --- /dev/null +++ b/daylight/layers/coastline/clean.sql @@ -0,0 +1,22 @@ +-- Licensed under the Apache License, Version 2.0 (the License); you may not use this file except +-- in compliance with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software distributed under the License +-- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +-- or implied. See the License for the specific language governing permissions and limitations under +-- the License. +DROP MATERIALIZED VIEW IF EXISTS osm_coastline CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z12 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z11 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z10 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z9 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z8 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z7 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z6 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z5 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z4 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z3 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z2 CASCADE; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_z1 CASCADE; diff --git a/daylight/layers/coastline/index.sql b/daylight/layers/coastline/index.sql new file mode 100644 index 000000000..2edba5b13 --- /dev/null +++ b/daylight/layers/coastline/index.sql @@ -0,0 +1,22 @@ +-- Licensed under the Apache License, Version 2.0 (the License); you may not use this file except +-- in compliance with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software distributed under the License +-- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +-- or implied. See the License for the specific language governing permissions and limitations under +-- the License. +CREATE INDEX IF NOT EXISTS osm_coastline_index ON osm_coastline USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z12_index ON osm_coastline_z12 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z11_index ON osm_coastline_z11 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z10_index ON osm_coastline_z10 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z9_index ON osm_coastline_z9 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z8_index ON osm_coastline_z8 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z7_index ON osm_coastline_z7 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z6_index ON osm_coastline_z6 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z5_index ON osm_coastline_z5 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z4_index ON osm_coastline_z4 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z3_index ON osm_coastline_z3 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z2_index ON osm_coastline_z2 USING SPGIST (geom); +CREATE INDEX IF NOT EXISTS osm_coastline_z1_index ON osm_coastline_z1 USING SPGIST (geom); diff --git a/basemap/layers/water/overlay.js b/daylight/layers/coastline/overlay.js similarity index 100% rename from basemap/layers/water/overlay.js rename to daylight/layers/coastline/overlay.js diff --git a/basemap/layers/water/prepare.sql b/daylight/layers/coastline/prepare.sql similarity index 94% rename from basemap/layers/water/prepare.sql rename to daylight/layers/coastline/prepare.sql index 4df82540c..fc9c0b59e 100644 --- a/basemap/layers/water/prepare.sql +++ b/daylight/layers/coastline/prepare.sql @@ -7,5 +7,5 @@ -- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -- or implied. See the License for the specific language governing permissions and limitations under -- the License. -CREATE MATERIALIZED VIEW osm_water AS +CREATE MATERIALIZED VIEW osm_coastline AS SELECT row_number() OVER () as id, '{"ocean":"water"}'::jsonb as tags, st_setsrid(geometry, 3857) AS geom FROM water_polygons_shp; diff --git a/basemap/layers/water/simplify.sql b/daylight/layers/coastline/simplify.sql similarity index 52% rename from basemap/layers/water/simplify.sql rename to daylight/layers/coastline/simplify.sql index 1912ef70e..5117a3274 100644 --- a/basemap/layers/water/simplify.sql +++ b/daylight/layers/coastline/simplify.sql @@ -7,74 +7,74 @@ -- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -- or implied. See the License for the specific language governing permissions and limitations under -- the License. -CREATE VIEW osm_water_z20 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z20 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z19 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z19 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z18 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z18 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z17 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z17 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z16 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z16 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z15 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z15 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z14 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z14 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE VIEW osm_water_z13 AS -SELECT id, tags, geom FROM osm_water; +CREATE VIEW osm_coastline_z13 AS +SELECT id, tags, geom FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z12 AS +CREATE MATERIALIZED VIEW osm_coastline_z12 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z11 AS +CREATE MATERIALIZED VIEW osm_coastline_z11 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z10 AS +CREATE MATERIALIZED VIEW osm_coastline_z10 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z9 AS +CREATE MATERIALIZED VIEW osm_coastline_z9 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z8 AS +CREATE MATERIALIZED VIEW osm_coastline_z8 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z7 AS +CREATE MATERIALIZED VIEW osm_coastline_z7 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z6 AS +CREATE MATERIALIZED VIEW osm_coastline_z6 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z5 AS +CREATE MATERIALIZED VIEW osm_coastline_z5 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z4 AS +CREATE MATERIALIZED VIEW osm_coastline_z4 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z3 AS +CREATE MATERIALIZED VIEW osm_coastline_z3 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z2 AS +CREATE MATERIALIZED VIEW osm_coastline_z2 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom -FROM osm_water; +FROM osm_coastline; -CREATE MATERIALIZED VIEW osm_water_z1 AS +CREATE MATERIALIZED VIEW osm_coastline_z1 AS SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom -FROM osm_water; +FROM osm_coastline; diff --git a/basemap/layers/water/tileset.js b/daylight/layers/coastline/tileset.js similarity index 85% rename from basemap/layers/water/tileset.js rename to daylight/layers/coastline/tileset.js index 75ac07333..6c364a012 100644 --- a/basemap/layers/water/tileset.js +++ b/daylight/layers/coastline/tileset.js @@ -15,12 +15,12 @@ export default { { "minzoom": 0, "maxzoom": 12, - "sql": "SELECT id, tags, geom FROM osm_water_z$zoom" + "sql": "SELECT id, tags, geom FROM osm_coastline_z$zoom" }, { "minzoom": 12, "maxzoom": 20, - "sql": "SELECT id, tags, geom FROM osm_water" + "sql": "SELECT id, tags, geom FROM osm_coastline" } ] } diff --git a/daylight/tileset.js b/daylight/tileset.js index 394507f3d..9069361d1 100644 --- a/daylight/tileset.js +++ b/daylight/tileset.js @@ -28,7 +28,7 @@ import man_made from "../basemap/layers/man_made/tileset.js"; import power from "../basemap/layers/power/tileset.js"; import point from "../basemap/layers/point/tileset.js"; import waterway from "../basemap/layers/waterway/tileset.js"; -import water from "../basemap/layers/water/tileset.js"; +import water from "./layers/coastline/tileset.js"; export default { diff --git a/daylight/workflow.js b/daylight/workflow.js index 8205bab29..92b590480 100644 --- a/daylight/workflow.js +++ b/daylight/workflow.js @@ -14,7 +14,6 @@ import config from "./config.js"; export default { "steps": [ - /* { "id": "daylight-data", "needs": [], @@ -109,28 +108,27 @@ export default { }, { "type": "ExecuteSql", - "file": "../basemap/layers/water/clean.sql", + "file": "./layers/coastline/clean.sql", "database": config.database, }, { "type": "ExecuteSql", - "file": "../basemap/layers/water/prepare.sql", + "file": "./layers/coastline/prepare.sql", "database": config.database, }, { "type": "ExecuteSql", - "file": "../basemap/layers/water/simplify.sql", + "file": "./layers/coastline/simplify.sql", "database": config.database, "parallel": true, }, { "type": "ExecuteSql", - "file": "../basemap/layers/water/index.sql", + "file": "./layers/coastline/index.sql", "database": config.database, }, ] }, - */ { "id": "daylight-preferred-localization", "needs": ["daylight-data"],