[OSM-dev] Converting OSM Mapnik stylesheet to Cascadenik or Carto

Komяpa me at komzpa.net
Fri Jul 29 06:28:19 BST 2011


2011/7/28 Frederik Ramm <frederik at remote.org>:
>> The suggestion to "fix tilemill to support MapCSS like everyone else
>> does" is laughable, really. I would certainly promote convergence in
>> the syntaxes, but that's more likely to be by MapCSS tacking towards
>> everyone else than the other way around.
> I guess that's the kind of skewed view one gets when one deals only with OSM
> software - after all, recent months have seen MapCSS used in all major OSM
> editors, a JavaScript based rendering engine, an Android map client...

It's rather hard to fully support MapCSS in Mapnik - it has been made
by people sick of some mapnik's limitations :)

The "simple way to make MapCSS renderer" is different from what we've
got in mapnik, so when trying to make converters from mapcss to
mapnik, you've got to chose the hard ways. For instance, in Komap, I
had to skip "cascading" part of MapCSS - single statement in
stylesheet becomes a number of symbolizers (up to ~15 for now).

MapCSS-based renderers and Mapnik-like ones have different ideology of

in mapnik, you:
 - take out of database these things;
 - render with this rules, in order they come from db;
 - repeat with other query and rules.

in mapcss-like renderers,
 - take out of database everything you need, or a bit more if it's easier;
 - map a style to each of the elements from database;
 - sort them by z-index property;
 - render each elements with applied stylesheet.

Mapnik's approach is more memory-effective, and is good enough for
most GIS data (without all those layer= tags and such things that are
hell to handle in mapnik really correct).

MapCSS-like approach is good for OSM specifically, as it is in fact
just a set of human-recognized tags mapped into a set of
machine-readable tags. I think MapCSS can be also used for defining
routing engine rules, and probably for defining transformations
between OSM tags and mapping standards/shapefiles used by others.

MapCSS can easily be used in mapnik-like way, just add different
subpart names to different rules. And it's not that easy to make
cascading work in mapnik-like renderers.

Personally, I wish there was mapcss-enabled (even in limited way, like
Komap) version of tilemill  - then probably I won't have to continue
development of user interface with map style editor and switch to some
more interesting things, like realigning imagery with traces :)

Darafei "Komяpa" Praliaskouski
xmpp:me at komzpa.net mailto:me at komzpa.net

More information about the dev mailing list