Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a script that will square the corners of polygons that are near 90 degrees but not exactly. Near could be dealt with via a variable, for example within 5 degrees of 90 (85 - 95 degrees).

For a more detailed description and some rather formal pseudo code, please refer to the following ESRI thread (particularly William Huber's post) :

share|improve this question
Note that the ESRI forums post includes a working spreadsheet, so there is code in addition to pseudocode. The crux of the matter is solving an optimization problem. ArcGIS doesn't have tools for this, but its add-ins (such as R and Python) do. It would be a fun little script to write for those with the skills...(which wouldn't include me: I'm not an ArcGIS programmer). – whuber Jun 8 '11 at 20:20
The following thread on measuring the angles of the corners of a polygon is a step in the right direction -… – Brent Edwards Jun 9 '11 at 12:46
This looks promising! – Brent Edwards Dec 1 '15 at 19:13
A similar question on esri forum: – Barbarossa Mar 18 at 3:44
@Barbarossa - Here is the ArcGIS tool that the makes reference to -…. I just ran a quick test and the tool works well. Obviously, parameter tweaking is necessary to optimize the results for each use case. – Brent Edwards Mar 18 at 14:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.