MapBox

Creating a Mapnik XML file

The main file TileMill needs to start a rendering job is a Mapnik XML map definition. While it's possible to write these files directly, for even slightly complex maps it is much easier to generate one with one of a couple tools.

Cascadenik

Home Page | Support

Cascadenik is a code pre-processor that allows you to design a map using a language that is very similar to Cascading Style Sheets (CSS). A Cascadenik .mml file is like a Mapnik XML file with some useful features added:

  • you can define styles in a CSS-like way, either in the same document or referenced to an external .mss file
  • you can assign classes and IDs to your layers, and use them to select various layers in your style definitions

The stylesheet language itself offers many of the advantages of CSS, like inheritence and a variety of ways to select elements.

You will need to download and set up Mapnik and Cascadenik on your computer to generate Mapnik files this way and preview your map designs before you upload them. Information about setting up & using these tools be found on the Mapnik wiki and the Mapnik-Utils project page.

Example styles

Check out Development Seed's MapBox repository on GitHub for example Cascadenik styles which you are free to download, edit, and redistribute (see the LICENSE.txt for details).

Quantumnik (QuantumGIS plugin)

Home Page | Support

Quantumnik is a plugin that allows you to design and export Mapnik maps using QuantumGIS, a cross-platform desktop GIS application. With Quantumnik, you can quickly preview what maps will look like and then generate MapBox-compatible XML styles.

Why Cascadenik? Why Quantumnik?

If you aren't comfortable editing CSS, then Quantumnik is your best option: you can edit map styles without touching any code, and there's very little challenge to setting up your map-editing environment.

However, there are some limitations to Quantumnik which make Cascadenik the best choice for advanced users: Quantumnik does not allow zoom-dependent styles yet, and these are quite essential for many maps. Zooming in on a map will usually reveal gradually more data; the view of the entire world in OpenStreetMap doesn't show every road, and roads tend to become larger with higher zoom levels.