I want to export the position and rotation of labels with placement "Free" as I need them in Mapbox, which has inferior label placement compared to QGIS.

I've tried with various polygon-to-point operations (centroid, pole of inacessibility) and they don't give me the same result and in any case don't contain rotation.

Essentially, I want to copy this to Mapbox:

enter image description here

Similar to Turn line labels in QGIS to a new point shape layer - but I have a polygon layer and that method won't work.

  • You'll probably need to control the label rotation with a "rotation" attribute. That will mean reproducing the label rotations that QGIS generates in the "free" placement setting. You might be able to do that with an expression in the Field Calculator, if you can figure out the criteria used for label rotation. It looks like labels are usually horizontal where the polygon is wide enough; otherwise they're oriented with the longest axis of the polygon. Something like if( width of polygon > length of label + 10mm, 0 degrees, orientation of feature's longest axis) – csk Sep 30 at 16:59

Your Answer

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

Browse other questions tagged or ask your own question.