# How to rectify polygon-shapes in Quantum-GIS? [duplicate]

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

Is there any way I can do this in quantum-gis (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
@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
@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
show 1 more comment