https://github.com/mapnik/cascadenik
Cascading Sheets Of Style for Mapnik
https://github.com/mapnik/cascadenik
Last synced: 11 months ago
JSON representation
Cascading Sheets Of Style for Mapnik
- Host: GitHub
- URL: https://github.com/mapnik/cascadenik
- Owner: mapnik
- License: bsd-3-clause
- Created: 2010-08-10T05:25:27.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2017-05-18T06:45:15.000Z (almost 9 years ago)
- Last Synced: 2025-04-20T13:19:01.485Z (11 months ago)
- Language: Python
- Homepage: http://github.com/mapnik/Cascadenik/wiki/Cascadenik
- Size: 3.08 MB
- Stars: 111
- Watchers: 9
- Forks: 20
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
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:
/* Define a few colors */
@black: #000;
@orange: #f90;
/* Start with a white background */
Map
{
map-bgcolor: #fff;
}
/* Draw roads as orange lines */
#roads
{
/* 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 */
name
{
text-placement: line;
text-face-name: "DejaVu Sans Book";
text-fill: @black;
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