This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch 745-daylight in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit 96f6859292fb69947e1c72f0756be4b1b871fc37 Author: Bertil Chapuis <[email protected]> AuthorDate: Wed Aug 30 00:06:05 2023 +0200 Adapt the workflow to daylight --- basemap/daylight.js | 430 ++++++++++++++++++++++++++++++++++++++ basemap/daylight/workflow.js | 423 ------------------------------------- basemap/layers/water/clean.sql | 23 ++ basemap/layers/water/index.sql | 22 ++ basemap/layers/water/overlay.js | 34 +++ basemap/layers/water/prepare.sql | 11 + basemap/layers/water/simplify.sql | 80 +++++++ basemap/layers/water/tileset.js | 26 +++ 8 files changed, 626 insertions(+), 423 deletions(-) diff --git a/basemap/daylight.js b/basemap/daylight.js new file mode 100644 index 00000000..2c6c5ba2 --- /dev/null +++ b/basemap/daylight.js @@ -0,0 +1,430 @@ +/** + 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. + **/ + +let config = { + "database": "jdbc:postgresql://localhost:5432/daylight?user=daylight&password=daylight" +}; + +export default { + "steps": [ + // { + // "id": "openstreetmap-data", + // "needs": [], + // "tasks": [ + // { + // "type": "DownloadUrl", + // "url": "https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf", + // "path": "data/data.osm.pbf" + // }, + // { + // "type": "ImportOsmPbf", + // "file": "data/data.osm.pbf", + // "database": config.database, + // "databaseSrid": 3857 + // }, + // ] + // }, + // { + // "id": "openstreetmap-download", + // "needs": ["openstreetmap-data"], + // "tasks": [ + // { + // "type": "DownloadUrl", + // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/fb-ml-roads-v1.29.osc.bz2", + // "path": "data/roads.osc.bz2" + // }, + // { + // "type": "DownloadUrl", + // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/admin-v1.29.osc.bz2", + // "path": "data/admin.osc.bz2" + // }, + // { + // "type": "DownloadUrl", + // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/coastlines-v1.29.tgz", + // "path": "data/coastlines.tgz" + // }, + // { + // "type": "DownloadUrl", + // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/preferred-localization-v1.29.tsv", + // "path": "data/preferred-localization.tsv" + // }, + // { + // "type": "DownloadUrl", + // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/important-features-v1.29.json", + // "path": "data/important-features.json" + // }, + // ] + // }, + // { + // "id": "openstreetmap-decompress", + // "needs": ["openstreetmap-download"], + // "tasks": [ + // { + // "type": "DecompressFile", + // "compression": "bzip2", + // "source": "data/roads.osc.bz2", + // "target": "data/roads.osc" + // }, + // { + // "type": "DecompressFile", + // "compression": "bzip2", + // "source": "data/admin.osc.bz2", + // "target": "data/admin.osc" + // }, + // { + // "type": "DecompressFile", + // "compression": "targz", + // "source": "data/coastlines.tgz", + // "target": "data/coastlines" + // }, + // ] + // }, + // { + // "id": "openstreetmap-import", + // "needs": [], + // "tasks": [ + // { + // "type": "ImportOsmChange", + // "file": "data/roads.osc", + // "database": config.database, + // "srid": 3857 + // }, + // { + // "type": "ImportOsmChange", + // "file": "data/admin.osc", + // "database": config.database, + // "srid": 3857 + // }, + // ] + // }, + // { + // "id": "openstreetmap-coastlines", + // "needs": [], + // "tasks": [ + // { + // "type": "ImportShapefile", + // "file": "data/coastlines/water_polygons.shp", + // "database": config.database, + // "sourceSRID": 4326, + // "targetSRID": 3857 + // }, + // ] + // } + { + "id": "openstreetmap-nodes", + "needs": [], + "tasks": [ + { + "type": "ExecuteSql", + "file": "queries/osm_nodes.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-ways", + "needs": [], + "tasks": [ + { + "type": "ExecuteSql", + "file": "queries/osm_ways.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-relations", + "needs": [], + "tasks": [ + { + "type": "ExecuteSql", + "file": "queries/osm_relations.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-member", + "needs": [], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/member/prepare.sql", + "database": config.database, + }, + ] + }, + { + "id": "openstreetmap-point", + "needs": ["openstreetmap-nodes"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/point/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/point/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/point/index.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-linestring", + "needs": ["openstreetmap-member"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/linestring/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/linestring/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/linestring/index.sql", + "database": config.database, + }, + ] + }, + { + "id": "openstreetmap-polygon", + "needs": ["openstreetmap-member"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/polygon/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/polygon/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/polygon/index.sql", + "database": config.database, + }, + ] + }, + { + "id": "openstreetmap-highway", + "needs": ["openstreetmap-linestring"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/highway/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/highway/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/highway/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/highway/index.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-railway", + "needs": ["openstreetmap-linestring"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/railway/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/railway/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/railway/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/railway/index.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-route", + "needs": ["openstreetmap-linestring"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/route/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/route/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/route/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/route/index.sql", + "database": config.database, + "parallel": true, + }, + ] + }, + { + "id": "openstreetmap-natural", + "needs": ["openstreetmap-polygon"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/natural/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/natural/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/natural/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/natural/index.sql", + "database": config.database, + "parallel": true + }, + ] + }, + { + "id": "openstreetmap-landuse", + "needs": ["openstreetmap-polygon"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/landuse/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/landuse/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/landuse/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/landuse/index.sql", + "database": config.database, + "parallel": true + }, + ] + }, + { + "id": "openstreetmap-waterway", + "needs": ["openstreetmap-linestring"], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/waterway/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/waterway/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/waterway/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/waterway/index.sql", + "database": config.database, + "parallel": true + }, + ] + }, + { + "id": "openstreetmap-water", + "needs": [], + "tasks": [ + { + "type": "ExecuteSql", + "file": "layers/water/clean.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/water/prepare.sql", + "database": config.database, + }, + { + "type": "ExecuteSql", + "file": "layers/water/simplify.sql", + "database": config.database, + "parallel": true, + }, + { + "type": "ExecuteSql", + "file": "layers/water/index.sql", + "database": config.database, + }, + ] + }, + ] +} diff --git a/basemap/daylight/workflow.js b/basemap/daylight/workflow.js deleted file mode 100644 index d0a2c24e..00000000 --- a/basemap/daylight/workflow.js +++ /dev/null @@ -1,423 +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. - **/ - -let config = { - "database": "jdbc:postgresql://localhost:5432/daylight?user=daylight&password=daylight" -}; - -export default { - "steps": [ - // { - // "id": "openstreetmap-data", - // "needs": [], - // "tasks": [ - // { - // "type": "DownloadUrl", - // "url": "https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf", - // "path": "data/data.osm.pbf" - // }, - // { - // "type": "ImportOsmPbf", - // "file": "data/data.osm.pbf", - // "database": config.database, - // "databaseSrid": 3857 - // }, - // ] - // }, - // { - // "id": "openstreetmap-download", - // "needs": ["openstreetmap-data"], - // "tasks": [ - // { - // "type": "DownloadUrl", - // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/fb-ml-roads-v1.29.osc.bz2", - // "path": "data/roads.osc.bz2" - // }, - // { - // "type": "DownloadUrl", - // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/admin-v1.29.osc.bz2", - // "path": "data/admin.osc.bz2" - // }, - // { - // "type": "DownloadUrl", - // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/coastlines-v1.29.tgz", - // "path": "data/coastlines.tgz" - // }, - // { - // "type": "DownloadUrl", - // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/preferred-localization-v1.29.tsv", - // "path": "data/preferred-localization.tsv" - // }, - // { - // "type": "DownloadUrl", - // "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/important-features-v1.29.json", - // "path": "data/important-features.json" - // }, - // ] - // }, - // { - // "id": "openstreetmap-decompress", - // "needs": ["openstreetmap-download"], - // "tasks": [ - // { - // "type": "DecompressFile", - // "compression": "bzip2", - // "source": "data/roads.osc.bz2", - // "target": "data/roads.osc" - // }, - // { - // "type": "DecompressFile", - // "compression": "bzip2", - // "source": "data/admin.osc.bz2", - // "target": "data/admin.osc" - // }, - // { - // "type": "DecompressFile", - // "compression": "targz", - // "source": "data/coastlines.tgz", - // "target": "data/coastlines" - // }, - // ] - // }, - { - "id": "openstreetmap-import", - "needs": [], - "tasks": [ - // { - // "type": "ImportOsmChange", - // "file": "data/roads.osc", - // "database": config.database, - // "srid": 3857 - // }, - // { - // "type": "ImportOsmChange", - // "file": "data/admin.osc", - // "database": config.database, - // "srid": 3857 - // }, - ] - }, - { - "id": "openstreetmap-coastlines", - "needs": [], - "tasks": [ - { - "type": "ImportShapefile", - "file": "data/coastlines/water_polygons.shp", - "database": config.database, - "sourceSRID": 4326, - "targetSRID": 3857 - }, - ] - } - // { - // "id": "openstreetmap-nodes", - // "needs": [ - // "openstreetmap-data" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "queries/osm_nodes.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-ways", - // "needs": [ - // "openstreetmap-data" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "queries/osm_ways.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-relations", - // "needs": [ - // "openstreetmap-data" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "queries/osm_relations.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-member", - // "needs": [ - // "openstreetmap-data" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/member/prepare.sql", - // "database": config.database, - // }, - // ] - // }, - // { - // "id": "openstreetmap-point", - // "needs": [ - // "openstreetmap-nodes" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/point/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/point/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/point/index.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-linestring", - // "needs": [ - // "openstreetmap-member" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/linestring/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/linestring/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/linestring/index.sql", - // "database": config.database, - // }, - // ] - // }, - // { - // "id": "openstreetmap-polygon", - // "needs": [ - // "openstreetmap-member", - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/polygon/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/polygon/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/polygon/index.sql", - // "database": config.database, - // }, - // ] - // }, - // { - // "id": "openstreetmap-highway", - // "needs": [ - // "openstreetmap-linestring" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/highway/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/highway/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/highway/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/highway/index.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-railway", - // "needs": ["openstreetmap-linestring"], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/railway/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/railway/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/railway/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/railway/index.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-route", - // "needs": ["openstreetmap-linestring"], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/route/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/route/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/route/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/route/index.sql", - // "database": config.database, - // "parallel": true, - // }, - // ] - // }, - // { - // "id": "openstreetmap-natural", - // "needs": ["openstreetmap-polygon"], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/natural/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/natural/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/natural/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/natural/index.sql", - // "database": config.database, - // "parallel": true - // }, - // ] - // }, - // { - // "id": "openstreetmap-landuse", - // "needs": [ - // "openstreetmap-polygon" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/landuse/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/landuse/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/landuse/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/landuse/index.sql", - // "database": config.database, - // "parallel": true - // }, - // ] - // }, - // { - // "id": "openstreetmap-waterway", - // "needs": [ - // "openstreetmap-linestring" - // ], - // "tasks": [ - // { - // "type": "ExecuteSql", - // "file": "layers/waterway/clean.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/waterway/prepare.sql", - // "database": config.database, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/waterway/simplify.sql", - // "database": config.database, - // "parallel": true, - // }, - // { - // "type": "ExecuteSql", - // "file": "layers/waterway/index.sql", - // "database": config.database, - // "parallel": true - // }, - // ] - // }, - ] -} diff --git a/basemap/layers/water/clean.sql b/basemap/layers/water/clean.sql new file mode 100644 index 00000000..42e42c10 --- /dev/null +++ b/basemap/layers/water/clean.sql @@ -0,0 +1,23 @@ +-- 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 new file mode 100644 index 00000000..cbd35c95 --- /dev/null +++ b/basemap/layers/water/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_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/layers/water/overlay.js b/basemap/layers/water/overlay.js new file mode 100644 index 00000000..5a31e359 --- /dev/null +++ b/basemap/layers/water/overlay.js @@ -0,0 +1,34 @@ +/** + 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. + **/ +import {withSortKeys, asLayerObject} from "../../utils/utils.js"; +import theme from "../../theme.js"; + +let directives = [ + { + filter: ['==', ['get', 'ocean'], 'water'], + 'fill-color': theme.oceanWaterFillColor, + 'fill-sort-key': 10, + }, +]; + +export default asLayerObject(withSortKeys(directives), { + id: 'ocean_overlay', + type: 'fill', + source: 'baremaps', + 'source-layer': 'ocean', + layout: { + visibility: 'visible', + }, + paint: { + 'fill-antialias': true, + }, +}); diff --git a/basemap/layers/water/prepare.sql b/basemap/layers/water/prepare.sql new file mode 100644 index 00000000..4df82540 --- /dev/null +++ b/basemap/layers/water/prepare.sql @@ -0,0 +1,11 @@ +-- 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 MATERIALIZED VIEW osm_water 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/basemap/layers/water/simplify.sql new file mode 100644 index 00000000..1912ef70 --- /dev/null +++ b/basemap/layers/water/simplify.sql @@ -0,0 +1,80 @@ +-- 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 VIEW osm_water_z20 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z19 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z18 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z17 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z16 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z15 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z14 AS +SELECT id, tags, geom FROM osm_water; + +CREATE VIEW osm_water_z13 AS +SELECT id, tags, geom FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z12 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z11 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z10 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z9 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z8 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z7 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z6 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z5 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z4 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z3 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z2 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom +FROM osm_water; + +CREATE MATERIALIZED VIEW osm_water_z1 AS +SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom +FROM osm_water; diff --git a/basemap/layers/water/tileset.js b/basemap/layers/water/tileset.js new file mode 100644 index 00000000..db1675b7 --- /dev/null +++ b/basemap/layers/water/tileset.js @@ -0,0 +1,26 @@ +/** + 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. + **/ +export default { + "id": "ocean", + "queries": [ + { + "minzoom": 0, + "maxzoom": 10, + "sql": "SELECT id, tags, geom FROM osm_water_simplified" + }, + { + "minzoom": 10, + "maxzoom": 20, + "sql": "SELECT id, tags, geom FROM osm_water" + } + ] +}
