Tuesday 29 May 2018

qgis - Fix Polygons to be true Rectangles


I got a featureclass polygon of 4 point polygons that delineate the coverage area of a georeferenced image; these polygons will later be map sheets. Anyway I discovered some of them are not true rectangles and I was wondering if there was a tool or script out there for either Arc or QGIS that could analyse a polygon and reshape it to be a perfect rectangle.



Answer



Converting a polygon into a perfect rectangle means the same than closing it inside a minimum bounding rectangle (MBR). There are two sorts of MBRs: an oriented rectangle which has its axes in the same direction as the coordinate system, or truly minimum rectangle which can be rotated. The oriented one is also called as Envelope.



Let's begin with two polygons.


enter image description here


The envelopes (created with OpenJUMP: Analysis - Geometry Functions - Envelope)


enter image description here


The Minimum Bounding Rectangles (created with OpenJUMP: Analysis - Geometry Functions - Minimum Bounding Rectangle):


enter image description here


However, I do not believe you should warp your image footprints to suit with these perfect rectangles. The footprints probably are as they are for reason.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...