I'm using QGIS 2.6.1 and would like to label US state polygons such that each border is lined with the label of its two states. Something like this:

Border labels

It appears that the current labeling engine only offers the ability to label above, on, or below the line. This results in something that looks more like this:

Wrong labels

What I need is options for interior vs exterior labeling. Is there some way that I can achieve this effect? Any tips?


With the Placement options

[x] Using perimeter
[x] Below line
[x] Line orientation dependent position

and a Distance value of 5 mm it looks good for me, but still sometimes fails if there is not enough space on the expected side:

enter image description here

I guess creating a negative buffer and placing the labels on that is not what you want.

  • I missed the 'Line Orientation Dependent Position' option. This seems to have solved the issue, although there isn't a way to make the labels wrap around polygon boundaries. Your idea for a negative buffer might be my best option. – spencerrecneps Jan 22 '15 at 17:29
  • The bad thing about the buffer is that the label will move away from the border if you zoom in, because the buffer is in real world map units and not pixel. – AndreJ Jan 22 '15 at 19:31

You can use force_rhr($geometry), to force your polygon beeing drawn respecting right hand rule together with geometry generator.

Go to label properties --> placement. Check the box for "geometry generator" and insert force_rhr($geometry) as expression and make sure to choose "Polygon" as geometry type in the dropdown box below. Now select "Using Perimeter" as Placement Mode and check "Line orientation dependend position" as well as "Right of line":

enter image description here


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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