This blog post is the first part of a short series of blog posts discussing the use of lines in maps, in particular of more complex line signatures.
Let us first consider lines as a micro-element in map design, which includes not only a simple hairline or a line of constant width but also anything that in classical map drawing is produced with a directed stroke with a drawing tool like a pen, brush or nib – or with a similar stroke with a cutting tool when the map is produced by directly engraving a printing plate.
Lines in this sense are traditionally the most important and most widespread design element used in maps. This applies in particular to the golden age of cartography in the 19th and early 20th century where map production techniques typically limited the use of color. Line drawing was extensively used not only for depicting things like rivers, roads and boundaries but also in the form of hachures and later contour lines to depict relief and through water lines to depict water areas for example. Here are some examples from the late 19th and early 20th century.
But this extensive use of lines had a substantial drawback: It made map production very work intensive. Every stroke in the line work in a map was the manual work of a highly qualified map designer.
Daniel P. Huffman’s discussion of water lines cites an estimate for example that drawing of water lines alone accounted for 18 percent of the production costs in some cases.
This and the changes in map printing technology allowing the use of a wider range of colors and color intensities through half-toning significantly decreased the use of lines as design elements in favor of more extensive use of color in the second half of the 20th century but especially with the raise of digital technologies in map production.
The move to digital map production techniques was severely limiting the use of lines as map design elements because initially the digital technologies typically used
- only allowed for simple constant width lines following a sequence of straight segments (a linestring) with the only design parameters typically being line cap and line join shape and potentially some form of dashing following a fixed pattern along the course of the line.
- required the drawing of these simple lines to be directly tied to and based on a linestring or polygon outline geometry.
In other words: The use of lines in map design has over the last 50 years essentially been reduced to lines as a macro-element of constant width, optionally with a regular dashing pattern of some sort. This development was the combined result of cost cutting in map production and the loss of capabilities in the move from more flexible analog map production technology to more simplistic and more limited digital systems.
History of line drawing in OSM-Carto
Among digital map rendering frameworks the one used by OSM-Carto – Mapnik – has from the early days on been a bit more flexible than other frameworks by providing the possibility to render line patterns. Line patterns are images to be drawn along a line string geometry as a line signature. Initially, these could only be raster images – which severely limited use due to the inevitable lack of precision in rendering. Still – this substantially increased design options beyond the basic line of constant width paradigm. In other words: It substantially widened the ability to work with lines as a macro-element, that is working with linear geometries within cartographic data and drawing something (which can be, but does not necessarily have to be lines as a micro-element as discussed above) along the course of a line.
OSM-Carto’s main use of line patterns initially was the rendering of cliffs and embankments.
Later versions of Mapnik allowed using SVGs for that purpose, greatly improving the quality of line pattern rendering. For cliffs and embankments in OSM-Carto this was adopted in 2017.
Despite their flexibility and usefulness, line patterns in Mapnik are a fairly limited way of defining more complex line signatures. The pattern image is mechanically placed and cut in a piecewise linear fashion along the course of the line string with no possibility to define line joins or line caps or other ways to adjust the line pattern locally to the geometry. In the rendering of tree rows i showed here some time ago for example i had to manually render the line signature from individual tree symbols to get the desired design. When introducing the rendering of ridges/aretes (based on a design idea that was originally developed for OSM-Carto by someone else) in my style i used line patterns but cut out peaks from the line for a better readable rendering. The pattern idea in 2019 was adopted by OSM-Carto – but without the cutting out of peaks.
More recently Mapnik got another feature improving the rendering of complex line signatures – that is the use of 2d patterns (like the ones used for polygon fills) as a drawing signature of lines. In contrast to line patterns where the pattern image is rendered along the line, the 2d pattern rendering uses a tiled 2d pattern not rotated along the direction of the line as fill. This simplifies use of 2d patterns for line rendering which previously had required use of compositioning operations. OSM-Carto uses this feature for unpaved roads now.
Apart from the shortcomings w.r.t. rendering more complex line design concepts (where Mapnik, however, is still not worse that most other map rendering tools) there is also the severe and annoying limitation that the line caps of a line as a whole also define the line caps of the dashing pattern used and both cannot be adjusted independently from one another. But that is just a side note here.
I think this illustrates a bit on what very basic (not to say primitive) level line drawing in digital maps often still is these days compared to what was the state of the art in pre-digital map production. This very basic level is largely owed to the technical limitation of map rendering frameworks – but also to the limited interest of many map designers to actually explore the technical capabilities that exist. In the next blog post i am going to show a bit what can be done with the means that line patterns offer in OpenStreetMap based map styles.