diff --git a/daylight/config.js b/daylight/config.js index 124861f55..b60f62271 100644 --- a/daylight/config.js +++ b/daylight/config.js @@ -15,7 +15,7 @@ limitations under the License. **/ export default { - "host": "http://localhost:9000", + "host": "http://demo.baremaps.com:9091", "database": "jdbc:postgresql://localhost:5432/daylight?&user=daylight&password=daylight", "center": [0, 0], "bounds": [-180, -85.0511, 180, 85.0511], diff --git a/daylight/layers/coastline/clean.sql b/daylight/layers/coastline/clean.sql index b49165305..bf02dfc79 100644 --- a/daylight/layers/coastline/clean.sql +++ b/daylight/layers/coastline/clean.sql @@ -8,15 +8,4 @@ -- 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; +DROP MATERIALIZED VIEW IF EXISTS osm_coastline_simplified CASCADE; diff --git a/daylight/layers/coastline/index.sql b/daylight/layers/coastline/index.sql index 2edba5b13..16cca7f34 100644 --- a/daylight/layers/coastline/index.sql +++ b/daylight/layers/coastline/index.sql @@ -8,15 +8,4 @@ -- 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); +CREATE INDEX IF NOT EXISTS osm_coastline_simplified_index ON osm_coastline_simplified USING SPGIST (geom); diff --git a/daylight/layers/coastline/overlay.js b/daylight/layers/coastline/overlay.js index 5a31e3598..00ebdd4b6 100644 --- a/daylight/layers/coastline/overlay.js +++ b/daylight/layers/coastline/overlay.js @@ -9,8 +9,8 @@ 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"; +import {withSortKeys, asLayerObject} from "../../../basemap/utils/utils.js"; +import theme from "../../../basemap/theme.js"; let directives = [ { diff --git a/daylight/layers/coastline/prepare.sql b/daylight/layers/coastline/prepare.sql index fc9c0b59e..6935a21be 100644 --- a/daylight/layers/coastline/prepare.sql +++ b/daylight/layers/coastline/prepare.sql @@ -9,3 +9,6 @@ -- the License. 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; + +CREATE MATERIALIZED VIEW osm_coastline_simplified AS +SELECT id, tags, st_simplifypreservetopology(geom, 300) as geom FROM osm_coastline WHERE ST_Area(geom) > 300000; diff --git a/daylight/layers/coastline/simplify.sql b/daylight/layers/coastline/simplify.sql deleted file mode 100644 index 5117a3274..000000000 --- a/daylight/layers/coastline/simplify.sql +++ /dev/null @@ -1,80 +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 VIEW osm_coastline_z20 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z19 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z18 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z17 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z16 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z15 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z14 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE VIEW osm_coastline_z13 AS -SELECT id, tags, geom FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z12 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z11 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z10 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z9 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z8 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z7 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z6 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z5 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z4 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z3 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z2 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom -FROM osm_coastline; - -CREATE MATERIALIZED VIEW osm_coastline_z1 AS -SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom -FROM osm_coastline; diff --git a/daylight/layers/coastline/tileset.js b/daylight/layers/coastline/tileset.js index 6c364a012..d1be640f7 100644 --- a/daylight/layers/coastline/tileset.js +++ b/daylight/layers/coastline/tileset.js @@ -14,13 +14,13 @@ export default { "queries": [ { "minzoom": 0, - "maxzoom": 12, - "sql": "SELECT id, tags, geom FROM osm_coastline_z$zoom" + "maxzoom": 10, + "sql": "SELECT id, tags, st_union(geom) FROM osm_coastline_simplified" }, { - "minzoom": 12, + "minzoom": 10, "maxzoom": 20, - "sql": "SELECT id, tags, geom FROM osm_coastline" + "sql": "SELECT id, tags, st_union(geom) FROM osm_coastline" } ] } diff --git a/daylight/style.js b/daylight/style.js new file mode 100644 index 000000000..2a6800abf --- /dev/null +++ b/daylight/style.js @@ -0,0 +1,127 @@ +/** + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to you 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 config from "./config.js"; + +import background from "../basemap/layers/background/style.js"; +import aeroway_line from "../basemap/layers/aeroway/line.js"; +import aeroway_polygon from "../basemap/layers/aeroway/polygon.js"; +import amenity_background from "../basemap/layers/amenity/background.js"; +import amenity_fountain from "../basemap/layers/amenity/fountain.js"; +import amenity_overlay from "../basemap/layers/amenity/overlay.js"; +import boundary_line from "../basemap/layers/boundary/line.js"; +import landuse_background from "../basemap/layers/landuse/background.js"; +import landuse_overlay from "../basemap/layers/landuse/overlay.js"; +import natural_background from "../basemap/layers/natural/background.js"; +import natural_overlay from "../basemap/layers/natural/overlay.js"; +import natural_tree from "../basemap/layers/natural/tree.js"; +import natural_trunk from "../basemap/layers/natural/trunk.js"; +import power_background from "../basemap/layers/power/background.js"; +import power_tower from "../basemap/layers/power/tower.js"; +import power_cable from "../basemap/layers/power/cable.js"; +import leisure_background from "../basemap/layers/leisure/background.js"; +import leisure_overlay from "../basemap/layers/leisure/overlay.js"; +import railway_tunnel from "../basemap/layers/railway/tunnel.js"; +import railway_line from "../basemap/layers/railway/line.js"; + +import highway_line from '../basemap/layers/highway/highway_line.js'; +import highway_outline from '../basemap/layers/highway/highway_outline.js'; +import highway_dash from '../basemap/layers/highway/highway_dash.js'; +import highway_tunnel_line from '../basemap/layers/highway/tunnel_line.js'; +import highway_tunnel_outline from '../basemap/layers/highway/tunnel_outline.js'; +import highway_pedestrian_area from '../basemap/layers/highway/pedestrian_area.js'; +import highway_bridge_line from '../basemap/layers/highway/bridge_line.js'; +import highway_bridge_outline from '../basemap/layers/highway/bridge_outline.js'; +import highway_construction_line from "../basemap/layers/highway/construction_line.js"; +import highway_construction_dash from "../basemap/layers/highway/construction_dash.js"; +import highway_label from '../basemap/layers/highway/highway_label.js'; + +import coastline_overlay from './layers/coastline/overlay.js'; +import route_line from "../basemap/layers/route/style.js" +import building_shape from "../basemap/layers/building/shape.js"; +import building_number from "../basemap/layers/building/number.js"; +import man_made_bridge from "../basemap/layers/man_made/bridge.js"; +import man_made_pier_line from "../basemap/layers/man_made/pier_line.js"; +import man_made_pier_label from "../basemap/layers/man_made/pier_label.js"; +import waterway_line from "../basemap/layers/waterway/line.js" +import waterway_label from "../basemap/layers/waterway/label.js" +import waterway_tunnel_line from "../basemap/layers/waterway/tunnel_line.js" +import waterway_tunnel_casing from "../basemap/layers/waterway/tunnel_casing.js" +import icon from "../basemap/layers/point/icon.js"; +import country_label from '../basemap/layers/point/country_label.js'; +import point_label from '../basemap/layers/point/point_label.js'; + +export default { + "version": 8, + "name": "OpenStreetMapVecto", + "center": config.center, + "zoom": config.zoom, + "sources": { + "baremaps": { + "type": "vector", + "url": `${config.host}/tiles.json` + } + }, + "sprite": `https://baremaps.apache.org/sprites/osm/sprite`, + "glyphs": "https://baremaps.apache.org/fonts/{fontstack}/{range}.pbf", + "layers": [ + background, + power_background, + aeroway_polygon, + landuse_background, + leisure_background, + amenity_background, + natural_background, + landuse_overlay, + natural_overlay, + amenity_overlay, + leisure_overlay, + coastline_overlay, + waterway_line, + waterway_tunnel_casing, + waterway_tunnel_line, + man_made_bridge, + amenity_fountain, + highway_tunnel_outline, + highway_tunnel_line, + railway_tunnel, + building_shape, + building_number, + highway_construction_dash, + highway_construction_line, + highway_outline, + highway_line, + highway_dash, + highway_pedestrian_area, + railway_line, + highway_bridge_outline, + highway_bridge_line, + highway_label, + aeroway_line, + route_line, + power_cable, + power_tower, + man_made_pier_line, + man_made_pier_label, + natural_tree, + natural_trunk, + boundary_line, + waterway_label, + icon, + point_label, + country_label, + ], +}; \ No newline at end of file diff --git a/daylight/tileset.js b/daylight/tileset.js index 9069361d1..e4510394a 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 "./layers/coastline/tileset.js"; +import coastline from "./layers/coastline/tileset.js"; export default { @@ -55,7 +55,7 @@ export default { leisure, man_made, natural, - water, + coastline, point, power, railway, diff --git a/daylight/workflow.js b/daylight/workflow.js index 1d9305b87..c3bb5b1f1 100644 --- a/daylight/workflow.js +++ b/daylight/workflow.js @@ -118,12 +118,6 @@ export default { "file": "./layers/coastline/prepare.sql", "database": config.database, }, - { - "type": "ExecuteSql", - "file": "./layers/coastline/simplify.sql", - "database": config.database, - "parallel": true, - }, { "type": "ExecuteSql", "file": "./layers/coastline/index.sql",