[Updated] The Mapnik 0.7.0 release last month has added a number of features, including one that makes choropleth maps, and others with numerous adjacent polygons, more pretty. The PolygonSymbolizer has a new parameter, gamma, which, when set to a value between 0 and 1, causes the polygon edges to bleed into each other slightly, removing distinctive hairlines that allow the background colour to “shine through” the joins.
Here’s a before-and-after of a choropleth of England & Wales. We don’t care much for the boundaries, as they are Middle-Level Super Output Areas (MSOAs), which are administrative boundaries that people are not familiar with, unlike say county boundaries. So, using the gamma parameter, we can hide them.
The new parameter is also useful for my OpenOrienteeringMap project, particularly to make large estuaries, which are typically made up of multiple polygons, appear contiguous.
However, applying too low a value appears to affect the anti-aliasing of line features, even ones away from the affected polygons. Here, the gamma is just applied to the “water” style. Note the thin white line crossing the water, near the black dotted line that also crosses it, disappears , but the paths and roads start to distort too:
Mapnik 0.6 – thin white line running across the river.
Mapnik 0.7+patch (Gamma 0.8) – the thin white line has gone. Other features are unchanged.
The map tile, by the way, is showing the Greenwich Foot Tunnel crossing the River Thames in east London.
[Update – The crossed-out section highlights a bug that has now been fixed by the Mapnik development team. I’ve patched my Mapnik build and the gamma changes now only appear where expected.]