I have used the OMBB (Oriented Minimum Bounding Box) Tool in QGIS to calculate OMBBs around polygons. However, there must be a mistake in the tool as all the yellow boxes in the picture below are calculated to have angles (= bearing) of around 90 degrees, but I can tell they have different orientations, and some of them are clearly not oriented in 90 degree direction.

enter image description here

Some other orientations seem to be calculated correctly - however, sometimes the long and sometimes the short sides of the boxes are used for the orientation/angle.

Any thoughts on how I can make the tool work properly or ideas for other QGIS tools or pyqgis scripts I could use?

  • Please clarify. The angles in a box are always 90 degrees but I think that you mean something else. Could you add into your sketch the boxes as you think they are correct?
    – user30184
    Dec 21, 2019 at 17:46
  • 1
    @user30184 - edited it - by angle I don't mean the angles in the box, I mean the orientation/bearing of the box as it should be automatically calculated in the "angle" attribute table column that is created by using the OMBB tool.
    – mnowatzki
    Dec 21, 2019 at 18:07
  • What are the layer and the project CRS? Dec 22, 2019 at 3:32
  • 1
    Problem solved! I had used 3.8 previously, and now I tried it with 3.10 and it seems to have worked - not sure if that was the issue, I was trying around lots of things in between... Regarding the problem that for some of the boxes the orientation angle is calculated using the long side, and for some the short side is used: I noticed that whenever in the attribute table the calculated WIDTH > HEIGHT, the short side of the box determines the angle, when WIDTH < HEIGHT the long side determines the angle. So that can be fixed with a tiny field calculator expression.
    – mnowatzki
    Dec 22, 2019 at 13:22
  • 1
    Can you provide the field calculator expression
    – HansrajR
    Jan 14, 2021 at 15:57


Browse other questions tagged or ask your own question.