This repository is a practical example of the process for locally generating, editing, and exporting vector tiles from OpenStreetMap (OSM) data.
Before diving into the repository, make sure you have the following installed:
- go-pmtiles: Install this essential tool by executing
make install-pmtiles
for macOS. Alternatively, you can download and install it from the go-pmtiles releases page. - Docker: Docker is required to run the Maputnik editor.
- Task Runner: We use Task as a task runner to streamline the workflow.
then run the following command to set up the environment:
task setup
Fetch the osm.pbf
OSM data, for example, from Geofabrik, and place it in the data/
directory.
as example, you can run:
task dl-pbf
We utilize tilemaker to generate mbtiles from the OSM data:
task make-mbtiles
To preview the generated mbtiles:
task preview-mbtiles
We convert the mbtiles to pmtiles before proceeding with style editing and map image exporting, since pmtiles are easy to host locally.
task convert-pmtiles
For editing the map style, follow these steps:
- Launch the Maputnik editor:
task run-maputnik
- Open your preferred web browser and navigate to
http://localhost:8888
. - Within the Maputnik UI:
- Click on "Open."
- Choose "Upload" and select the style JSON file located in the
style/
directory. - Customize the style according to your preferences.
To export the map as an image, execute:
task run-export
This command will locally serve the web app for the exporting process.