I have some polygon-shapes in qgis-1.7.0 and want to ensure that every polygon is a rectangle. See image below.

enter image description here

Is there any way I can do this in QGIS (or any other f/oss)? Or how can I improve my polygon-drawing to make sure for example that every building consists of rectangles (all angels = 90°)?

Any hints appreciated! Thanks!

  • Ignore my close flag. It is a different question. – Nathan W Dec 28 '12 at 11:54
  • In theory it should be pretty easy to write something to do this. Loop each point in the odd shape, checking the angle to the next point from the current one if it's not 90 then calculate the new point and adjust the point. Now someone just needs to write the code :) – Nathan W Dec 28 '12 at 13:17
  • read this answer for orthogonal digitizing. – Aragon Dec 28 '12 at 14:02
  • 2
    @Nathan It's nowhere as easy as that in general, because each time you change a vertex location you create distortions elsewhere. Even when fixing near-rectangles (as opposed to more complicated polygons) you can wind up producing new features that are clearly not very good approximations to the original ones. One problem is that there is not a unique way to calculate a new point at a bad vertex. See forums.esri.com/Thread.asp?c=93&f=987&t=303128#948330 for a discussion and pseudocode. I tested that approach (using Excel, of all things!) and found that it tends to work well. – whuber Dec 28 '12 at 16:23
  • 1
    @Under I cannot find it either. A closely related one (where I wrote a comment, not an answer) is Finding Polygons Without Right Angles. In my search I also uncovered How to Create Polygons with Straight Lines and Right Angles in QGIS as well as a duplicate (which I have just closed and merged). – whuber Dec 31 '12 at 14:26

There is a QGIS Tool called Oriented minimum bounding box. You can find it under Processing > QGIS geoalgorithms > Vector general tools. I'm using QGIS 2.18.

Maybe this comes close to what you want to achieve.

enter image description here

|improve this answer|||||
  • Cool, this is very close to what I have been looking for! – Afr Jan 18 '18 at 15:53

You can fix it with bounding box area of all polygons. The name of function is Polygon from layer extent.

enter image description here

Select your layer and mark the option calculate extent for each feature separately:

enter image description here

All original polygons are present in the same layer, not separately. QGIS will calculate the bounding box area for all entities:

enter image description here

QGIS Rocks! Hugs from Brazil!

Jorge Santos

|improve this answer|||||
  • The answer does not take into account the rotation of the polygons. – GreyHippo Sep 26 '16 at 15:04

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.