This article demonstrates how to download and serve a city’s map on your Macbook.
1. Download openstreetmap data
Firstly we need to get the OpenStreetMap data for rendering tiles, you can download it from various places, refer “LearnOSM – Getting OSM Data” to get the specific data you want. I downloaded Auckland city data from BBBike.org
2. If there is no Docker installed on your Mac, download and install it.
3. Setting up the tiles server:
1). Create new volume in Docker:
% docker volume create openstreetmap-data
2). Use openstreetmap-tile-server to build the server, start importing the “.pbf” file into PostgreSQL by running a container and mounting the file as /data.osm.pbf. Remember to use the physical file path:
% docker run -v /Users/ukalpa/Downloads/Auckland.osm.pbf:/data.osm.pbf -v openstreetmap-data:/var/lib/postgresql/12/main overv/openstreetmap-tile-server import
3). Running the server
% docker run -p 8301:80 -v openstreetmap-data:/var/lib/postgresql/12/main -d overv/openstreetmap-tile-server run
Now, the tiles server has been installed successfully, access http://localhost:8301 and you will see the Auckland map details:



For more details about openstreetmap-tile-server, please refer: https://github.com/Overv/openstreetmap-tile-server
2 replies on “Build your self-host world map – Download data and render tiles on your mac”
Hi,
thank you for all the good work you do. Unfortunally i run into a problem with step 2. Docker loads your repo, but the import seems to fail. I get the error message:
[code]
Status: Downloaded newer image for overv/openstreetmap-tile-server:latest
docker: Error response from daemon: create Downloads/Auckland.osm.pbf: “Downloads/Auckland.osm.pbf” includes invalid characters for a local volume name, only “[a-zA-Z0-9][a-zA-Z0-9_.-]” are allowed. If you intended to pass a host directory, use absolute path.[/code]
My commadline is:
[code]docker run -v Downloads/Auckland.osm.pbf:/data.osm.pbf -v openstreetmap-data:/var/lib/postgresql/12/main overv/openstreetmap-tile-server import[/code]
Hi Steve,
Sorry for the late reply. Try using your real path of the pdf file to replace “Downloads/Auckland.osm.pbf” which is the path on my computer.