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:
/* 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
==========
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
Project details
Release history Release notifications | RSS feed
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.4.0.tar.gz
(52.1 kB
view details)
File details
Details for the file cascadenik-2.4.0.tar.gz
.
File metadata
- Download URL: cascadenik-2.4.0.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cfb461eb95081fbfc0500e5785f7c3d810b30b1d4474fe48863916cbbf6ed4c |
|
MD5 | c7a45b0bd78adae33a655cf9c86ffe2f |
|
BLAKE2b-256 | 24af407be3a51f00823b38ee2e0199cf5a5781aaf63c110f0eb9d0b5d72b9fb7 |