Curved labels

Back in my cartography class, in the mid-2000s, we were told to avoid non-horizontal labels in digital maps where possible, in order not to lose the map’s legibility. While there is some truth in it, curved labels – carefully placed – can also have a very positive effect in helping the user to understand topographic maps. As our EOX Maps are mainly used to help visualizing Earth Observation (EO) data, we are interested in optimizing our label overlays as good as possible. Therefore we put quite some effort in improving our labeling strategies as well.

Apart from OpenStreetMap there is another great resource for map data, called Natural Earth. It is a collection of helpful datasets to create maps for various scales. Among these datasets, there are two providing the most important mountain ranges, valleys, regions, island groups and so on. These features are mapped as polygons, but labeling a polygon is quite tricky as most tools use the center point to place the label on. As mountain ranges, for example the Andes, can reach from South to North, we would like the label to be placed vertically along the center line of the source geometry.


Finding out the center line of a polygon is not as straight forward as it sounds but there are some tricks to get a good approximation. A common method is to calculate a Voronoi diagram and extract the middle axis.

In our approach we refined this method a bit by:

  • first, segmentizing the geometry to make sure the points are roughly evenly distributed around the geometry,
  • apply some simplification for performance reasons before creating the Voronoi diagram,
  • find the “best” centerline, and
  • finally, smooth the line geometry to get an evenly curved label.

We developed a command line tool written in Python and made it available for everyone as Open Source under a MIT license. Feel free to use and improve it and don’t forget to sent us your feedback. If you have any questions, you are welcome to contact us.

Published by


Lead Cartographer at EOX. Open Source GIS and geodata processing enthusiast.