Skip to content

denisbraud/osm-tiles-docker

 
 

Repository files navigation

zavpyj/osm-tiles

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

Background

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

Prerequisite

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

Usage

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

Atomic Usage

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

Creating .png format tiles

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.

Direct Usage

Initialise if not already done (initdb+import+render) and Start OSM server (startservices)

$ docker-compose -f osm.yml up -d

About

The OpenStreetMap Tile Server in a Docker container

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 46.8%
  • Dockerfile 29.5%
  • Perl 11.4%
  • HTML 11.0%
  • sed 1.3%