From OpenStreetMap Wiki
Jump to navigation Jump to search

Spreadnik is a Mapnik-preprocessor by Iván Sánchez that accepts CSV spreadsheets in a custom format and produces traditional Mapnik stylesheet chunks.

The goal of Spreadnik is not to generate a fully compliant mapnik stylesheet, but to ease the pain of editing big, complex stylesheets.

Using spreadnik

Users of spreadnik are expected to know how Mapnik XML stylesheets work, specially how to use XML entities to link stuff; what is Mapnik's definition of "symbolizer"; the options of most commonly used symbolizers; and how to use the generate_image.py script (found in the OSM SVN repo).

See Spreadnik/Tutorial, which covers usage quite deeply.


You'll need PHP5 and spreadsheet software. Spreadnik has been tested on PHP5 on Linux (command-line), with the spreadsheets edited on OpenOffice.org Calc. YMMV if you're using PHP5 on other systems, or some other spreadsheet software (i.e. excel)

How to get it

Just check-out the openstreetmap SVN repository, Spreadnik is under the "utilities" directory.


Spreadnik has a horrible algorithmic complexity. Anyway, the goal is not to be lightning quick, but to ease the editing of stylesheets. Expect spreadnik to last for up to a minute if your spreadsheets is big (complexity tends to be O(e^n), n being the number of different tag values).

In order to speed things up (and make clearer sheets), try to keep different tags in different sheets, and try to have as few different tag values as possible in one given sheet (i.e. don't put lots of values in a sheet for no reason).

TODO: understand Chilton's style

One secondary goal of Spreadnik is to de-construct the default Mapnik stylesheets. This default style has seen contributions from various people, Steve Chilton being one of the most notable cartographers contributing to it.

Due to the sheer size of the default stylesheets, it is quite difficult to understand how a given tag is rendered at different zoom levels. A set of spreadnik sheets that exactly replicate the "Chilton style" will ease this. However, this is still a work in progress.


Spreadnik is under a beer-ware license. If you find spreadnik useful, and if you happen to meet Ivansanchez (maybe during The State of the Map), you have to pay him a beer. Otherwise, do what you want with the software.

Source code

The source code can be found on the SVN.