Skip to main content

Cascading Stylesheets For Mapnik

Project description


Cascadenik implements cascading stylesheets for Mapnik.

It’s an abstraction layer and preprocessor that converts special, CSS-like
syntax into Mapnik-compatible style definitions. It’s easier to write complex
style rules using the alternative syntax, because it allows for separation of
symbolizers and provides a mechanism for inheritance.

Cascadenik supports many of Mapnik’s features in a simple declarative form:

/* Define a few colors */
@black: #000;
@orange: #f90;

/* Start with a white background */
map-bgcolor: #fff;

/* Draw roads as orange lines */
/* Usually, 3px wide */
line-width: 3;
line-color: @orange;

/* Make the important ones wider */
&[kind=major] { line-width: 4 }
&[kind=highway] { line-width: 5 }

/* Add the road names in black */
text-placement: line;
text-face-name: "DejaVu Sans Book";
text-fill: @black;
text-size: 12;

See more examples at


See `` for installation instructions.

See the `doc/` folder for more usage examples.

Unroll the rules in example.mss and show their cascade order:

% example.mss > example-ordered-unrolled.mss

Compile `example.mml` into a Mapnik-suitable XML file:

% example.mml example-compiled.xml

Render a MML file directly to an image using

% example.mml example.png

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cascadenik, version 2.7.0
Filename, size File type Python version Upload date Hashes
Filename, size cascadenik-2.7.0.tar.gz (54.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page