Skip to content

Commit

Permalink
Improve the readme and fix minor style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis committed Jan 8, 2025
1 parent 4eaa528 commit 7b49d95
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
36 changes: 27 additions & 9 deletions basemap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion basemap/layers/railway/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 2 additions & 7 deletions basemap/layers/railway/tileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
2 changes: 1 addition & 1 deletion basemap/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion basemap/themes/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down

0 comments on commit 7b49d95

Please sign in to comment.