Intro

The MapntikTileServer is a time sensitive mapnik based tile server for OpenStreetMap and Open Historical Data Map. Written in python with the web framework Django and the official OpenStreetMap style sheets.

MapntikTileServer Frontend

Fig. 1 MapntikTileServer Frontend

What is a Tile?

A tile is a part of a map. On each zoom level, the map is split into zoom^4 map parts (tiles).

Tile

Fig. 2 Tile

What is a Tile server?

A Tile Server is a web service which handle user request over the HTTP / HTTPS protocol. A user request is defined over the request URL, as response get the user a single tile of a map.

Tile Server overview

Fig. 3 Tile Server overview

tiles of a map

Fig. 4 tiles of a map

There are some JavaScript libraries, which can handle tile server request and merge each tile to a map. The two most common libraries are Leaflet and OpenLayers.

MapntikTileServer vs other Tile-Servers

The main difference is, that this tile server can handle time request. So you can request a map of a specific date. To handle date specific request, the project openstreetmap-carto was use as base. Openstreetmap-carto is the github repository for the style sheets, which are used on https://openstreetmap.org/. To add time sensitive request, the project was forked and the project.mml file was modified to make SQL request for a specific day.

On the diagram below, is the workflow of the MapntikTileServer.

MapntikTileServer workflow

Fig. 5 MapntikTileServer workflow

Cookiecutter Django

The project was created with Cookiecutter Django and build up with docker. So if you unsure how to use this MapntikTileServer, read the Cookiecutter Django Docs for help.

For faster developing and better testing, this project use Docker and Docker-Compose to build and run the MapntikTileServer.

Celery Task Queue

For the production setup, the tile are produce in a Celery-Task-Queue. Celery is a python task queue, which run in extra threads / container for more performance. For every URL of a tile, which is not already in the cache, there will be triggered a new task on the queue.

Celery-worker get work from broker.

Fig. 6 Celery-worker get work from broker.

Every celery container have multiple threads, where it can process tile request. To scale up the production you can use with docker:

$ docker-compose -f production.yml scale celeryworker=2

Celery auto scale the threads, depending on your system load, as a recommendation is to scale celery to 2 containers.

More on: https://cookiecutter-django.readthedocs.io/en/latest/deployment-with-docker.html#building-running-production-stack

Celery-Task-Queue

Fig. 7 Celery-Task-Queue