I'm working with QGIS 3.16 Hannover and I'm labelling two adjacent polygons using the following parameters:

enter image description here

And labels are shown as this

enter image description here

I would like to displace them along the perimeter so they do not overlap with the yellow polygon. I've tried different combinations with the "priority" settings without any success.

  • It's not a particularly dynamic solution (and therefore may not meet your requirements), but have you seen that you can move labels manually?
    – Matt
    Commented Oct 22, 2021 at 20:36
  • 3
    As per the help center please do not include chit chat like statements of appreciation within your posts.
    – PolyGeo
    Commented Oct 23, 2021 at 6:04
  • @Matt Yes, I've considered that option, but it is usually quite messy when creating more maps with different scales.
    – jpinilla
    Commented Oct 23, 2021 at 9:29
  • I looked into label Blocking also (available from the dropdown where you choose the type of label). But unfortunately this literally just blocks the label and doesn't displace it. Though it might be suitable if you are using repeating labels
    – Matt
    Commented Oct 23, 2021 at 10:26

2 Answers 2


You can use a Label placement defined by Geoemtry Generator. Use it to define a polygon where placements are allowed: inside a buffer around the outer boundary of your polygons (bufferA), but not inside a buffer around a polygon from another layer, the "label blocking" polygon. Let's call the buffer around this "label blocking" polygon bufferB. Now you have to clip (difference) from bufferA the area of bufferB.

To achieve this, use this expression for label placement, where polygon2 is the name of the layer containing the label blocking polygons and the buffer size of 8000 and 1000 can be changed to suit your needs:

difference (
    single_sided_buffer (boundary($geometry), -8000),
    collect_geometries (
        overlay_nearest (
            buffer ($geometry, 1000),

Screenshot: yellow polygons are labeled in a way to avoid labels where the red polygon from another layer overlaps. The blue polygon is just for visualization purpose and shows the geomtry cretated using Geometry generator with the above expression: it defines the areas where labels are allowed:

enter image description here

  • Better solution this one, since the first incomprehensibly doesn't work sometimes
    – jpinilla
    Commented Oct 25, 2021 at 6:37

"Correct" placement of labels is tricky because many rules are involved. So sometimes it's still best practice to add labels manually (even using a Graphic software for high quality printed maps) as it is faster and produces better results. Of course, QGIS offers all the necessary tools to define extremely complex settings, but still, based on what you want to do, it will get more laborious than a manual solution.

It also depends if you want to set the label for a fixed scale and extent (easier to do) or if the labels should work correctly when you pan and zoom (more difficult).

In your case, a semi-manual option would be to use Geomtry generator to label not the polygon itself, but the boundary of it, using the expression boundary($geometry). You than have to option to click Settings of the Label Anchoring - see screenshot:

enter image description here

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.