-
Notifications
You must be signed in to change notification settings - Fork 50
Map Styling in cascadenik, carto
nvkelso edited this page Jan 25, 2012
·
17 revisions
Mapnik is the renderer for most open-source geo projects. But, raw Mapnik XML is crazy to read (let alone manually write). Enter: Cascadenik -&- Carto.
###Documentation
###Background
Both are stylesheet renderers for Mapnik.
- Carto is an evolution of the Cascadenik idea and language, with an emphasis on speed and flexibility.
- MML for layer contents, MSS stylizes the features
Cascadenik
- Styles map features using CSS and layer definitions
- Cascading Style Sheets have given web pages pizzaz for 15 years.
- CSS enables a separation between map layer .MML and their .MSS graphic appearance (it can easily be restyled)
- Cascadenik is command line tool, 2 yrs old
- Creates XML for Mapnik the 1st
Carto
- Builds on Cascadenik’s CSS language
- Can be used in TileMill from DevSeed
- The MML file is JSON instead of XML (harder to comment)
- Has arbitrary style attachments, cool!
- Can use expressions in names, specifying font face and size.
- Define variables in stylesheets, and use expressions to modify them.
- Color swatches like @mybackground: #2B4D2D;
- Then use it like: darken(@mybackground, 10%);
- Creates XML for Mapnik the 2nd
###Workflow
to convert TileMill “carto” stylesheets to cascadenik / mapnik happiness
cd /Applications/mapbox-tilemill/
./bin/carto /path/to/project/style.mml
./tilemill.js
Note: adjust path as appropriate.
To see the end result of your CSS expanded:
cascadenik-style.py stylesheet.mss
Out of ArcMap
- In ArcMap? Use Arc2Earth (arc2earth.com)
- Can export layer styles in OGC SLD Format, can adapt by hand to Cascadenik or Carto
- Don't know of a method in ArcPy to get layer graphic properties without going full on ArcObjects, nudge nudge.
Adjusting your styles thru multiple zooms
- Scale Master - Interactive tool (Flash) and papers from Cindy Brewer at Penn state on what to include on your map, when.