[Mapcss] komap - KOthic MApcss Processor

Komяpa me at komzpa.net
Mon Jan 31 17:25:17 GMT 2011


Hi everybody.

I've been developing a mapnik stylesheet for OSM data at
kosmosnimki.ru for some time.
Main map there is from commercial map data providers, but for some
places where they lack coverage OSM is used.
A couple of links to such OSM extracts:
http://kosmosnimki.ru/permalink.html?Nce4b1b72 - Minsk, Belarus (all
Belarus is from OSM data at z10-)
http://kosmosnimki.ru/permalink.html?Nd4b9a5dd - Rzhev, Russia (at z12-)
http://kosmosnimki.ru/permalink.html?Nc02e38b4 - Valaam island, Russia.

All that things were rendered using mapnik 0.7.1, postgis 2.0 and
postgres 9.0. Other versions weren't checked, although might work too
:)

Why mapnik? It's stable, rather fast and proved to be able to render
OSM data. It turned out that I'm too lazy to make my own rendering
engine of production-quality in short term.

But, I hate mapnik's stylesheets. That's why I wrote a
mapcss-to-mapnik stylesheet converter, komap.

http://code.google.com/p/kothic/source/browse/src/komap.py

There are some limitations: it can't really do cascading. I tried to
implement cascading, but resultimg mapnik stylesheets were 100+mb
which is too large. Looking forward to mapnik2, which probably will
let to do it better.

But, there are some cool features inside too:
 - long roads that were cut into pieces are glued back and are
labelled once, which is extremely useful in cities;
 - large cut-into-parts polygons are labelled once, or, at least, not
too often:  http://osm.org/go/e6aAYh_@- vs.
http://latlon.org/~komzpa/screenshots/komap1.png ;
 - L-shaped objects have their labels inside of them, not in center of
their bbox - http://kosmosnimki.ru/permalink.html?Nea27164d ;
 - If a marker has a label, and collision algorythms decide that label
doesn't fit into image, both label and a marker are taken away from
image;
 - It really takes layer= tag into account:
http://kosmosnimki.ru/permalink.html?N7fbb27ef
 - It somewhat tries to generate optimized SQL. It's not perfect, but works ;)

Why implementing a style converter instead of making mapnik understand
mapcss? Well, a converter could probably be easily modified to make
stylesheets for other renderers, like GeoServer or MapServer or
whatever.

I don't hope that it will be useful for somebody; it is already useful
for me. Enjoy ;)

-- 
Darafei "Komяpa" Praliaskouski
OSM BY Team
xmpp:me at komzpa.net mailto:me at komzpa.net



More information about the Mapcss mailing list