Placing elevation numbers on contours with uphill orientation and position in QGIS?

Here we go then, a method to get some control over contour label placement, see the picture.

The first thing I did was to load the contours. Next, on a new line shapefile, I drew a line from the top of the hill to the bottom (the labels in the picture are aligned with this). I then buffered the line and used the buffer to clip the contour layer. After that I loaded the clipped contours over the contour layer, set the symbology so that the little lines didn't render, and labelled the clipped layer using the new labelling system.

In the example shown I only used one straight line, but of course it would be possible to use polylines too, to produce better placed labels.

Oh, you only need a small buffer value, 50 metres I think I used in the example, even this might have been greater than strictly necessary.

enter image description here


Using parallel placement together with "bellow line" and "line orientation dependent position", I managed to put the labels on the uphill side always.

enter image description here

enter image description here

Curved placement currently seems to ignore line orientation though. (I reported the behavior.)

Also, it doesn't seem possible to achieve upside-down labels, if you were aiming for that.


What you could do is to make a point file from the contours with an attribute of the elevation (You can do this using any profile from line tool). Then add in the point the aspect value (You will need the aspect raster but that is easy to produce) and finally rotate the elevation label in the points according to the aspect (in fact it will need to be 180 degrees + aspect, because aspect is the downhill direction). You can style the points so they don't show. Hope this helps, it strongly depends on the details of your data, if the aspect doesn't match the contour direction it can be quite annoying.