This is a Docker image that provides a full stack for working w/ OpenStreetMap data. It can be used to:
- Initialize PostgreSQL database w/ PostGIS extensions:
initdb
- Import OpenStreetMap data into PostgreSQL database:
import
- Optionally pre-generate tiles:
render
- Serve pre-generated (if available) and dynamically generated tiles from Apache, renderd and mapnik via a Leaflet interface:
startservices
- Serve exclusively pre-generated tiles from Apache via a Leaflet interface:
startweb
This image is adapted from ncareol/osm-tiles-docker
, which is based on homme/openstreetmap-tiles-docker
, which is based on the Switch2OSM instructions.
It runs Ubuntu 18.04 LTS (Bionic) and is based on phusion/baseimage-docker. It includes:
- PostgreSQL
10
- PostGIS extensions
- Apache
2.4
- osm2pgsql
- mapnik
- mod_tile, an Apache module that also provides scripts for rendering tiles
Tiles are built with a CartoCSS map style stored by default in ../openstreetmap-carto
(see docker-compose.xml).
Clone, import and optionnaly customize with kosmtik as explained here
CartoCSS templates
- openstreetmap-carto, a CartoCSS template (mapnik style) for OpenStreetMap data
- Humanitarian Data Model
- Other alternatives
To build this image:
$ docker build -t zavpyj/osm-tiles .
Command reference is available in help.txt
or by running the image:
$ docker run --rm zavpyj/osm-tiles
To persist the postgresql database and the generated tiles, it is advised to create beforehand a docker's named volume (mandatory to persist on Windows OS):
$ docker volume create --name nvpostgisdata -d local
Using Docker Compose
and a dedicated docker-compose.yml
configuration file, zavpyj/osm-tiles is even simpler to use:
$ docker-compose run --rm app-osm initdb
$ docker-compose run --rm app-osm import
$ docker-compose run --rm app-osm render
$ docker-compose up -d
By default, tiles are created in .meta format. To convert these to .png format in an /z/x/y/ directory structure, run the following once the render process is complete:
$ docker-compose run --rm app-osm create_pngs
The tiles will be created in the png directory within /c/data/osm.
Initialise if not already done (initdb+import+render) and Start OSM server (startservices)
$ docker-compose -f osm.yml up -d