I have two road layers - one is a subset of the other, so, there's a lot of overlap. When they are coincident, I see labels from both layers.

enter image description here

The 'lower' layer is the thin line road in the SW corner; the 'upper' layer is the thicker line road with black edges.

One of the 'Ridge Rd' labels is from the upper layer, one is from the lower layer. Ultimately I'd like to get rid of this resulting 'double label' effect.

Is there a way to suppress labels from the lower layer when it is coincident with an object from the upper layer? Is the best way to do this by keeping them on the same single layer and just do a rule-based or categorized style, to avoid this whole multi-layer issue? That would have other side-effects though I haven't explored the option yet.

Thanks in advance

1 Answer 1


As you say conditional formatting can be an option. Alternatively you can do conditional labelling.

I don't know of a way to automatically look for a spatial overlap, but doing it manually is easy.

So we start out with out initial situation: Initial labelling

So we want the smaller lines to only be labelled when it is not overlapped by the bigger one.

First we want to do the spatial test to check for overlapping. Using the spatial query plugin (found in the plugins toolbar). We want to select all of the features in the lower dataset that "Equals" the top one. The selection is enough no need to create a layer.

Then we create a new field in the lower layer called "Overlaps", update only the selected rows and set them to "1".

Then we perform our conditional formatting, on the lower layer instead of just the label, we insert the expression: CASE WHEN "Overlaps" IS NULL THEN STREET END

End result: Final result

As we can see there is a lot less duplication in where the two datasets overlap.

  • yes, sorry, it's in the queue to try this out but schedule here has been slammed. I'll definitely follow up here. Thanks
    – Tom Grundy
    Commented Feb 8, 2014 at 1:33
  • I'm only getting a couple of result selections from the spatial query plugin, and it might be because the objects on the upper layer are merged together while the objects on the lower layer are segmented at each road intersection. So, the filters for crosses, equals, intersects, overlaps, and touches all return only a few selections, where there are actually hundreds of road segments that overlap. I'll try to get the segmentations identical and see if that does the trick...
    – Tom Grundy
    Commented Feb 10, 2014 at 5:49
  • Thinking about that, it wouldn't be practical to resegment all the upper layer roads to match the segmentation of the lower layer roads. Seems like it's a matter of the boolean logic in the spatial query: is there a way to check for 'partial overlaps', i.e. 'select lower layer objects that have all their points coincident with any upper layer object'? (or ultimately eliminate the need for the manual spatial query and find a syntax in the label expression to do all this)
    – Tom Grundy
    Commented Feb 10, 2014 at 6:04
  • A good example of the possible spatial queries can be found at: gaia-gis.it/spatialite-2.3.1/spatialite-tutorial-2.3.1.html Section 4.2 So you might want to do a "Contains" query to find the ones that do not need to be segmented. But I don't think you can do the query in the label expression. Labels are powerful and data driven, but do not have access to the spatial queries. Commented Feb 10, 2014 at 8:51
  • Although it seems a contains query cannot be done on two line layers in QGIS. So you best option would be to re segment the lines and do an "equals" query. Commented Feb 10, 2014 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.