Working on distributed map rendering mechanism

December 1, 2013    distributed rendering GBKN mapnik qgis

At the moment I am working on a solution for distributed map rendering. A customer asked me if I could help with rendering (a large number of) tiles, to be used in Google Maps. The area to be rendered spans about one third of The Netherlands, up to zoom level 22.

The first attempt was using QGis with the QTiles plugin. QGis continues to lend itself for multiple purposes, such as fast and easy geo-data visualisation. Unfortunately, the QGis renderer is not multi-threaded and thus cannot easily take full advantage of the CPU. One can work around this by running multiple instances of QGis. Also, QGis does not easily seem to provide an out-of-the-box offline rendering solution. This means that you (manually) have to start QGis and set it to rendering. It is hard to keep track of which instance is rendering what. Especially if one of the instances crashes.

A second attempt was built using Mapnik. Mapnik is a toolkit for developing mapping applications. It provides Python bindings so one can easily render a map from Python. Using TileMill, one can very quickly and easily create styling for a map, and export it to the Mapnik format. From there on, the map can easily be rendered by Mapnik.

Since the number of tiles is huge, a distributed approach is taken to speed up the rendering. Using Celery, each tile is sent to a worker, which renders the tile. The tile is then stored in a database. From the database, the tile can be quickly served to any client.

Soon, I will create a new post further describing the solution. Always exciting, working on ‘large’ problems!