From OpenStreetMap Wiki
Jump to navigation Jump to search
Pyrender london roads.png
Author: user:Ojw
License: GNU General Public License v3
Platforms: Windows, macOS, and Linux
Status: Broken
Language: English
Source code:
Programming language: Python


This article or section may contain out-of-date information: pyrender is not longer maintained and it seems that it does not work anymore. This article should be rewritten to explain that it worked in the past, but cannot be used
If you know about the current state of affairs, please help keep everyone informed by updating this information. (Discussion)

Pyrender is an on-demand map rendering framework, programmed in Python, written by User:Ojw. When it receives an HTTP request for a tile, it fetches the OSM data for the tile from OJW's tile data server, and renders the data as PNG.

The Pyrender code in the SVN repository does not work. Some of the reasons include:

  • OJW's tile server no longer exists
  • Changes in OpenLayers have broken the sample slippy map

Getting started

Check out pyrender from svn:

$ svn co

Start the tile server. You may need to install some prerequisites such as python, py-cairo.

$ cd pyrender
$ ./

Visit http://localhost:1280/ with a web browser. To view the map of somewhere other than London, you can edit the coordinates of a permalink.

Creating a custom slippy-map

Before pyrender

Method A:

  • Download the world
  • Install a database server
  • Install a webserver
  • Install mapnik
  • Create a config file to say what your map should look like

Method B:

  • Create a config file to say what your map should look like
  • Pre-render the world
  • Install a webserver

After pyrender

  • Create a config file to say what your map should look like
  • Run a python program that shows you a slippy map of your new map style without any other configuration

Technical stuff

Pyrender system.png

  • purple = concept
  • green = actual program that you can download from here

Getting tile data

We need someone to run a server for this - see tile data server


  • Can only view zoom 15 at the moment


  • Headers to allow browser caching
  • fix breakage when someone tags with layer=not_numeric
  • The overlay layers seem to have a minimum zoom level (z13 or so) - we want to zoom out more
  • openlayers isn't showing zoom levels > 17


These are from, which is a cairo renderer handling ways and areas:

Default layer, which is mainly roads, railways, footpaths

Water network, showing riverbanks, docks, coastlines, etc.

Pyrender docklands water.png

Borders layer (these are local borders of Camden, Westminster, etc. inside London):

Pyrender london borders.png

Zoom out a bit, and it starts merging tiles together to get enough data:

Pyrender motorway.png

Metro rail systems, showing the London Underground

Pyrender metro lines.png

Railway network layer, including railway station outlines:

Pyrender rail network.png

Features without a name (debug layer) (note: this shows all features without name tag, not just roads):

Pyrender noname.png

Building layer, being displayed on top of the default layer

Pyrender buildings.png

Rendering libraries

Base-classes are available for:

  1. Cairo (graphics)
  2. Python Imaging Library

however, each rendering module chooses which base-class to use (and in many cases, calls the graphics library functions itself), which means that in practice you have to have the right library installed for whichever renderer you want to run