TileMill Feature Preview: Compositing Operations

May 22 2012 by AJ Ashton

Artem and Dane have been hard at work on some fantastic new developments in Mapnik, the powerful map renderer that makes TileMill possible. The latest feature additions are a set of composite operations and image filters that will greatly expand design possibilities for maps. I took some time recently to experiment with these features and explore what new things are possible from a cartography perspective.

If you are familiar with graphics applications like PhotoShop or GIMP, you will recognize many of the new blending modes, such as multiply, overlay, color-dodge, and color-burn.

Here is an example of color-dodge in use. A number of light transparent polygons are overlaid on a dark base design. The many overlapping shapes combine to brighten the colors below, where normally they would produce an opaque fill that blocks the information beneath it.

Here’s another color-dodge example showing highways and ferry routes. Note that all of the lines have the same color applied to them in the stylesheet. The final look is determined by the information beneath that they are combined with, so ferry routes (and bridges) appear blue, and roads within city areas appear brighter.

Other compositing operations allow you to mask different pieces of data. Here’s an example of using a thick outline to mask different colored polygon fills. The polygon fills themselves are multiply-blended against the raster backdrop, resulting in tint-bands, a familiar cartographic effect.

Here I’m combining multiplied textures, line, and polygon fills for a printed paper effect. The red layer is made a bit more blobby with some positive and negative PostGIS buffering for simulated ink-bleeding.

Going crazy with compositing operations on lots of vector and raster layers can yield results that might be at home in a global domination video game.

These new features are still buggy and experimental. You can look forward to seeing them in TileMill releases in the coming months. Adventurous power users can check out the latest code on GitHub (Mapnik, TileMill, Carto), but there will be a few hurdles to getting things set up for the time being.