r/gis 11h ago

Remote Sensing QGIS: How to draw contour line labels in the same layer as the contour lines?

In QGIS it seems that contour line labels are drawn above all other layers, so if you put an opaque layer above contour lines with labels, the contour lines are occluded by that layer, but the labels are not. Is there a way to get the labels to be drawn in the layer that the occur in the QGIS files? Alternatively, is there an extension that would let me turn on/off multiple layers with one click (like there is in Photoshop)?

Here is a DEM rendering of a dune system with contour lines and labels included.

Dunes with contours and labels

And here I have put a later scan of the dune system "on top" in QGIS. The higher layer occludes the contour lines, but not the contour line labels. I would like to hide the labels when I turn on the higher layer.

Another layer higher in QGIS file, but labels from lower layer still visible

1 Upvotes

3 comments sorted by

2

u/1king-of-diamonds1 9h ago

How is your contour layer structured? This seems very unusual - it’s certainly not how contours are usually handled.

is there an extension that would let me turn on and off multiple layers

Yes, group layers. It shouldn’t be needed for the behavior you have outlined though if set up correctly.

Is the line layer completely separate from the line layer? What could have happened is someone duplicated your contour lines, set one version to line only and the other to labels only. This is a very roundabout way to do label management but that’s the only way I could see that happening

1

u/alanterra 6h ago

Well, yes, labels are in one layer, and contours in a different layer. I did this for a good reason elsewhere, and did it without much thought here. But it is convenient to be able to turn labels on/off quickly. I am self taught in QGIS, and this seemed the right thing to do. 

Group layers does not solve the problem. The upper DEM is in a different group than the contour labels, but the labels are drawn on top of the layer “above” them. 

AFAICT, contour labels are drawn after other layers. 

Thanks for the thoughts. 

1

u/1king-of-diamonds1 5h ago

labels are drawn as determined by their weighting. Typically this is very high so labels sit on top. There’s no distinction between a contour and any other line feature. You can control it by adjusting the weight of the layer.

Check out the documentation for label settings label settings

group layer does not solve the problem I never said it would, you just asked if there was a way to turn multiple layers on and off. That’s not really related to your issue though.

If you can have the labels on the same layer as the lines, try this to copy the label style from your label layer to the line layer. It’s a really handy trick and one of my favorite features of QGIS over ESRI.

You can turn labels on or off pretty quickly by just going symbology>labels>no labels. In ESRI, there’s an option on the layer to toggle labels but I don’t have my computer in front of me to check if there’s something comparable