Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Web API for printing high resolution PDF maps.


Lascaux works by passing in a link to a set of map tiles (similar to how Leaflet loads in TileLayers) and returning a high resolution PDF for printing. You can also set the map center, zoom level and size of your desired PDF.


  • center - Latitude,longitude of map center
  • dimensions - Height,width of desired map in pixels. Defaults to 1275,1650 (8.5" x 11" letter size). Another useful size is 2550,3300 (11" x 17" tabloid size)
  • zoom - Number indicating the zoom level from 1 (the whole world) to 20 (a city block). Defaults to 17.

Optional parameters:

  • overlay_tiles - Your map data tile layer in this format: http://{s}{z}/{x}/{y}.png. these tiles should support transparency
  • base_tiles By default, we use tiles from Open Street Map. If you want to provide your own, however, you can do so by providing an encoded URL to your own tile layer. Expects the same format as overlay_tiles

We use Open Street Map tiles because they show building addresses for zoom 17 and above. Here's what they look like:

Open Street Map

Here's some other base_tiles that are good for printing:

MapBox streets


Mapbox streets

Toner, by Stamen{z}/{x}/{y}.png

Toner, by Stamen

Terrain, by Stamen{z}/{x}/{y}.jpg

Terrain, by Stamen

Satellite by MapBox{z}/{x}/{y}.png

Satellite by MapBox

Basic example

Here's an 11" x 17" map of vacant properties around S 55th and W California on Chicago's South Side provided by LocalData and Southwest Organizing Project:,41.786456&dimensions=2550,3300&zoom=17&overlay_tiles={z}/{x}/{y}.png

lascaux demo

Custom base_tiles example

You can pass in your own base_tiles if you don't like ours. Here's the same LocalData map with Stamen's Toner base tiles:,41.786456&dimensions=2550,3300&zoom=17&overlay_tiles={z}/{x}/{y}.png&base_tiles={z}/{x}/{y}.png

Stamen Toner tiles

Making a request in python

>>> import requests
>>> params = {
              'center': [-87.69358, 41.786456],
              'dimensions': [2550, 3300], # tabloid size
              'zoom': 17,
              'overlay_tiles': '{z}/{x}/{y}.png'
>>> r = requests.get('', params=params)
>>> with open('my_map.pdf', 'wb') as f:

That should give you a file called my_map.pdf in your current working directory


Setting up Python and OpenCV

This is by far the biggest hassle. Once it is done, however, it never needs to be done again. These instructions work on Ubuntu 12.04. You’ll probably need to modify them to suit your particular environment. These directions also assume you have virtualenvwrapper setup as well.

$ mkvirtualenv printmatic
$ pip install numpy
$ sudo apt-get install cmake libgtk2.0-dev pkg-config libavcodec-dev \
  libavformat-dev libswscale-dev libamd2.2.0 libblas3gf libc6 libgcc1 \
  libgfortran3 liblapack3gf libumfpack5.4.0 libstdc++6 build-essential \
  gfortran libatlas-dev libatlas-base-dev libblas-dev liblapack-dev libjpeg-dev \
  libpng-dev libtiff-dev libjasper-dev
$ wget -O
$ mkdir src && mv src && cd src
$ unzip
$ cd opencv-2.4.5/
$ mkdir release
$ cd release
  -DPYTHON_PACKAGES_PATH=$VIRTUAL_ENV/lib/python2.7/site-packages \
$ make -j8 # Set the number here to the number of processing cores you have
$ make install

Mac install

Make a virtual environment

$ mkvirtualenv printmatic

Install the required libraries

$ pip install -r requirements.txt

Install OpenCV

This is a hassle. Maybe use brew?

I already had OpenCV installed, and had to copy to my virtualenv's site-packages. This probably can be dealt with better by some PATH manuvering.

Install Cairo

Getting Cairo set up has been a major pain. The most common problems are caused by it simply not being found. Try:

export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

(or just add it right to your PATH)

On Ubuntu you should be able to get libcairo and the appropriate header files thusly:

$ sudo apt-get install libcairo2-dev

Running the app

$ python


🌐 Web API for printing high resolution PDF maps




No releases published


No packages published