[GIS] Tile server with dynamic mapnik rendering, caching, and pre-emptive rendering

mapnikopenstreetmaptilemilltilestilestache

I've been making some pretty (but computationally expensive) tiles with TileMill and I'd like to serve them up.

First, I served them straight from TileMill. Every tile gets rendered dynamically, which is simple, but slow.

Next, I exported a region as MBTiles then served it with MBTiles-server. Every tile is served statically, which is fast, but exporting all the tiles is too slow (multiple days).

I'm looking at TileStache, which combines dynamic rendering with caching. I imagine that this means the first time a region is looked at, it will be extremely slow, then quick thereafter.

I have plenty of spare CPU time (8 cores, not being used for anything else) and plenty of disk space (terabytes). I'd really like a server that can:

a) serve cached tiles if available
b) dynamically render tiles if necessary
c) continuously render tiles in the background to maximise the cache hit rate

Is mod_tile the only option? I'd prefer to avoid Apache, and mod_tile's documentation looks messy.

For context, I want to serve tiles for the whole of Australia, down to zoom 15.

Best Answer

I had exact same need and ended up building two tools:

  • tilestrata – Pluggable tile server written in Node.js. There's a mapnik plugin and disk cache.
  • tilemantle – A command-line tool for warming the tile cache. It works by sending HEAD requests to the tileserver. Via a special header it can tell tilestrata to skip the cache and render a new tile. You can give it a region, zoom level range, etc. Execute it by hand, or set up a cron job to periodically rebuild different regions/zoom levels. In the tilestrata readme there's an example of how the two can work in tandem.