Skip to main content
Solved

Identifying polygons that are rectangly shaped?


aron
Supporter
Forum|alt.badge.img+16
  • Supporter

I am trying to find a way to simplify/generalize the dataset below. There are a number of neighbouring plots similar to the one marked in blue. I would like to merge (dissolve) as many as possible of these whilst retaining the overall shape and those plots with more distinctive shapes.

The original features are lines, but in the stage shown below I have created polygons and added a centre point.

The plots I want to merge are rectangle shaped and of similar size. They are of course not true rectangles, that would be to easy, most have around 7-12 vertices.

I tried the FuzzyParallelLineFinder but inner and outer lines where all computed. I want to keep the outer. I have the feeling that dissolving polygons will give me the result I want without having to patch everything up towards the end. But I could of course be wrong about that.

If there is a easier way to do this than the one I suggest below, please let me know!

My thinking is that in my "rectangles" the distance from the centre point C to corner A would be similar to that from C to corner B. Same for the other corners. Also the angle a would be similar to the angle b. I use the word similar because I would need to set some sort of tolerance for it to work.

Here is where I get stuck. How do I extract the distances from C to A,B, D and E, and the corresponding angles? Once that is extracted, what transformer would you recomend I use to do the comparative calculations?

 

overviewcloseupp_2

Best answer by david_r

Off the top of my head, one possibility could be to first create an oriented bounding box around each polygon, then use the Clipper to get the difference between the original polygon and the oriented bounding box. The remaining area as a percentage of the area before the clipping might be an indication of how rectangular the polygon is.

View original
Did this help you find an answer to your question?

3 replies

david_r
Evangelist
  • Best Answer
  • October 8, 2020

Off the top of my head, one possibility could be to first create an oriented bounding box around each polygon, then use the Clipper to get the difference between the original polygon and the oriented bounding box. The remaining area as a percentage of the area before the clipping might be an indication of how rectangular the polygon is.


redgeographics
Celebrity
Forum|alt.badge.img+49

I like @david_r​ 's suggestion. An alternative:

  1. Generalize them to get rid of as many of the extra points as possible. Ideally you'd end up with 4 points per polygon, so true rectangles (which by themselves would be an approximation of the actual shape due to the generalizing)
  2. Create circles around those 4 points
  3. Clip the circles with the (generalized) rectangle
  4. Calculate the area of the remaining circle segments and compare them. The closer they are to eachother the closer the angles at those points are.

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • October 8, 2020
david_r wrote:

Off the top of my head, one possibility could be to first create an oriented bounding box around each polygon, then use the Clipper to get the difference between the original polygon and the oriented bounding box. The remaining area as a percentage of the area before the clipping might be an indication of how rectangular the polygon is.

This is what I came here to say, though I would probably use an AreaOnAreaOverlayer rather than the clipper.

 

In either case you want a unique ID on the original features and use that as a group-by.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings