Skip to main content

Cascading Stylesheets For Mapnik

Project description

Cascadenik
==========

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:

/* Start with a white background */
Map
{
map-bgcolor: #000;
}

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

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

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

See more examples at https://github.com/mapnik/Cascadenik/wiki/Examples.

Usage
-----

See `INSTALL.md` for installation instructions.

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

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

% cascadenik-style.py example.mss > example-ordered-unrolled.mss

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

% cascadenik-compile.py example.mml example-compiled.xml

Render a MML file directly to an image using nik2img.py:

% nik2img.py 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.

Source Distribution

cascadenik-2.3.0.tar.gz (51.6 kB view details)

Uploaded Source

File details

Details for the file cascadenik-2.3.0.tar.gz.

File metadata

  • Download URL: cascadenik-2.3.0.tar.gz
  • Upload date:
  • Size: 51.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cascadenik-2.3.0.tar.gz
Algorithm Hash digest
SHA256 da80ae6555bdfe73599d0ca9d564a59ee066c9cdec9db68df775a55535986162
MD5 8309c895cd72a6112a0b02e8f85903dd
BLAKE2b-256 44d04108af22c619cf55be992c8167809530e159b04b7bbfd77f19421464aab4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page