[OSM-dev] A spreadsheet to generate Mapnik stylesheets

Andrew M. Bishop osm-lists at gedanken.org.uk
Sat Nov 23 17:26:45 UTC 2013


For the past few years I have used a slightly modified version of the
OSM Mapnik stylesheet on my own website.  With the recent change to
CartoCSS I transfered my patches across.  Both the original raw XML
format and the newer CSS type format are quite complicated to modify
(although the new format is easier than the old one).

To make creating Mapnik stylesheets even easier I have created a new
tool that is somewhat like Spreadnik [1] in that it uses a spreadsheet
to define the formatting.  Compared to Spreadnik though it is somewhat
simpler because one line in the spreadsheet can define everything
about a single object type (for example highway=motorway).

The spreadsheet has four types of style definition sheet:
 * shapefiles - for low zoom shapefiles, coastlines etc.
 * areas - for polygons with optionally: solid fill, pattern fill,
   outline, label.
 * lines - for linear features with optionally: casing, fill, tunnel
   and bridge styles, oneway arrows, up to two labels.
 * points - for nodes (and optionally polygons) with optionally:
   symbol, up to two labels.

The Perl script that processes the text files (exported from the
spreadsheet) will automatically generate a reasonably optimised SQL
statement for a group of objects and the styles and layers to draw
everything required for each zoom level.

I have written a longer description on a web page [2] which also
includes a download of the Perl script and the spreadsheet that
re-implements ~99% of the OSM map styles (with a few style changes).
The download is a bit rough at the moment, more like a dump of my
working version.  There is also a side-by-side slippy map comparison
[3] of the standard OSM stylesheet and this new stylesheet (for the UK
only).


[1] https://wiki.openstreetmap.org/wiki/Spreadnik
[2] http://www.gedanken.org.uk/mapping/custom-maps/
[3] http://www.gedanken.org.uk/mapping/custom-maps/comparison.html

-- 
Andrew.



More information about the dev mailing list