diff --git a/basemap/README.md b/basemap/README.md index 62b768309..e4bb7404e 100644 --- a/basemap/README.md +++ b/basemap/README.md @@ -16,9 +16,7 @@ limitations under the License. --> # OpenStreetMap Vecto -🚧 🚧 Work in progress 🚧 🚧 - -This directory contains the configuration files for a general-purpose map. +This directory contains the configuration files for a general-purpose map based on OpenStreetMap data. It is used to generate vector tiles and to produce a Mapbox style inspired by [OpenStreetMap Carto](https://github.com/gravitystorm/openstreetmap-carto). ## Requirements @@ -52,25 +50,39 @@ checkpoint_completion_target = 0.9 max_wal_senders = 0 ``` -## Importing the data +## Initializing the database -Assuming that the necessary requirements have been installed, the database can be populated with the following command. The import workflow will download openstreetmap (osm.pbf) and other data sources into the database. +Assuming that the necessary requirements have been installed, the database can be populated with the following commands. ``` +// This command creates the database schema +baremaps workflow execute --file create.js + +// This command imports the data into the database baremaps workflow execute --file import.js + +// This command refreshes the materialized views +baremaps workflow execute --file refresh.js ``` -## Updating the data +## Updating the database -The data can periodically be updated with the following command. The update workflow will download the latest changes from OpenStreetMap (osc.xml) and apply them to the database. +The database can periodically be updated with the following commands. +The update workflow will download the latest changes from OpenStreetMap (osc.xml) and apply them to the database. +Refreshing the materialized views is costly and only necessary if the low zoom levels need to be updated, therefore it is optional. ``` +// This command updates the database baremaps workflow execute --file update.js + +// This command refreshes the materialized views (optional) +baremaps workflow execute --file refresh.js ``` ## Serving the tiles and the style in dev mode The development server can be started with the following command. +The dev mode automatically reloads the map when the configuration files are modified, which is useful for development and testing. ``` baremaps map dev --log-level DEBUG \ @@ -106,8 +118,14 @@ Simply put, it adds in the ability to describe the `vector_tiles` and their cont ## Editing the style -The configuration format used in the `line.js` file follows the [Mapbox style specification](https://github.com/mapbox/mapbox-gl-js). -Baremaps integrates [Maputnik](https://maputnik.github.io/) and most of the modifications will take place in the browser. +The configuration format used in the `style.js` file follows the [Mapbox style specification](https://github.com/mapbox/mapbox-gl-js). + +## JavaScript as a configuration language + +All the configuration files are written in JavaScript instead of JSON. +This allows for more flexibility and the use of JavaScript functions to generate the configuration. +Additionally, it allows for imports and comments, which are not supported in JSON. +As the configuration files got bigger and more complex, this choice became more and more beneficial. ## Tools diff --git a/basemap/layers/railway/create.sql b/basemap/layers/railway/create.sql index a56d68bce..18d4947e7 100644 --- a/basemap/layers/railway/create.sql +++ b/basemap/layers/railway/create.sql @@ -103,7 +103,8 @@ CREATE 'rail', 'subway', 'tram' - ) WITH NO DATA; + ) + AND NOT tags ? 'service' WITH NO DATA; DROP MATERIALIZED VIEW IF EXISTS osm_railway_clustered CASCADE; diff --git a/basemap/layers/railway/tileset.js b/basemap/layers/railway/tileset.js index 249b34c8b..09ffe6755 100644 --- a/basemap/layers/railway/tileset.js +++ b/basemap/layers/railway/tileset.js @@ -18,14 +18,9 @@ export default { "id": "railway", "queries": [ { - "minzoom": 9, - "maxzoom": 13, - "sql": "SELECT id, tags, geom FROM osm_railway_z$zoom" - }, - { - "minzoom": 13, + "minzoom": 7, "maxzoom": 20, - "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'railway'" + "sql": "SELECT id, tags, geom FROM osm_railway_z$zoom" } ] } diff --git a/basemap/style.js b/basemap/style.js index 10ceaff9b..bc03a82d4 100644 --- a/basemap/style.js +++ b/basemap/style.js @@ -106,9 +106,9 @@ export default { highway_tunnel_line, building_fill, highway_construction_line, + highway_fill, highway_outline, highway_line, - highway_fill, railway_line, attraction_line, highway_bridge_outline, diff --git a/basemap/themes/default.js b/basemap/themes/default.js index 430c61b8c..1ba134aed 100644 --- a/basemap/themes/default.js +++ b/basemap/themes/default.js @@ -326,7 +326,7 @@ export default { manMadeIconColor: 'rgb(85, 85, 85)', manMadePierFillColor: 'rgb(184, 184, 184)', manMadePierLineColor: 'rgb(242, 239, 233)', - manMadePierLineWidth: [5, 0.5, 16, 3], + manMadePierLineWidth: [5, 0.5, 16, 2], manMadePierTextHaloColor: 'rgba(255,255,255,0.8)', manMadeWasteWaterPlantFillColor: 'rgb(235, 219, 231)', naturalBareRockBackgroundFillColor: 'rgb(217, 212, 206)',