Skip to main content
Question

How can I convert a polygon layer to have all 90 degree angles


geographygeek
Contributor
Forum|alt.badge.img+2

I have a polygon layer that was digitized manually and as a result, has some issues with overlaps and gaps. However, the first issue I would like to solve is making the polygons have right angles. They are all square or rectangle-type shapes so each vertex should have a 90 degree angle. Is there a way to manipultate the polgyons so that they are all at right angles? At this point, I would be able to check for snapping and other issues. Thanks!

7 replies

takashi
Influencer
  • October 30, 2023

Hi @geographygeek​ ,

I think you can use BoundingBoxReplacer to transform the polygons to perfect square or rectangular shapes whose corners are all 90 degrees.


geographygeek
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • October 30, 2023
takashi wrote:

Hi @geographygeek​ ,

I think you can use BoundingBoxReplacer to transform the polygons to perfect square or rectangular shapes whose corners are all 90 degrees.

Thanks for your suggesiton. It's not creating the right polygons. It is creating the bounding box, but my polygons represent buildings so they are not oriented in a way that this transformer would work. boundingbocx


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • October 30, 2023
takashi wrote:

Hi @geographygeek​ ,

I think you can use BoundingBoxReplacer to transform the polygons to perfect square or rectangular shapes whose corners are all 90 degrees.

The BoundingBoxReplacer has an option '2D Oriented Bounding Box' to create a rotated bounding box, oriented to the feature.

But based on the image you provided, that is also not what you are looking for.

 


takashi
Influencer
  • October 30, 2023

@geographygeek​ , it's an interesting challenge.

Summary of my idea is:

  1. Create an oriented bounding box of the polygon, and split its boundary into individual edge lines.
  2. Split boundary of the original polygon into individual segments,
  3. Make each segment parallel to a bounding box edge which is closest in angle,
  4. Recreate polygon from the modified segments.

​Implementation is a bit complex, please see the attached workspace example to learn more.

Just be aware that a slight calculation error cannot be avoided, so the resulting corner angles may not strictly match right angle.


geomancer
Evangelist
Forum|alt.badge.img+47
  • Evangelist
  • October 31, 2023

Nice solution!

@geographygeek​ reminded me that I once answered a similar question. I had competely forgotten that...


geographygeek
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 6, 2023
geomancer wrote:

Nice solution!

@geographygeek​ reminded me that I once answered a similar question. I had competely forgotten that...

@geomancer​ Sorry for the late reply. I actually found that question and tried it out. It works....until the end.....so I extended the lines and used intersector to chop them and rebuild the polygons. It's working for MOST of the features but I still have some falling out. I tried to use the line builder and then a line closer for those that fall out of the intersector/snapper/area builder but those are not giving me good results. Part of the issue is with the original dataset which was done by students and has some geometric issues. So I created another workbench to fix up those issues prior to processing.

 

I just downloaded @Takashi Iijima​ 's workbench and I'll see if I can incorporate some of that. Stay tuned!


geographygeek
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 6, 2023
takashi wrote:

@geographygeek​ , it's an interesting challenge.

Summary of my idea is:

  1. Create an oriented bounding box of the polygon, and split its boundary into individual edge lines.
  2. Split boundary of the original polygon into individual segments,
  3. Make each segment parallel to a bounding box edge which is closest in angle,
  4. Recreate polygon from the modified segments.

​Implementation is a bit complex, please see the attached workspace example to learn more.

Just be aware that a slight calculation error cannot be avoided, so the resulting corner angles may not strictly match right angle.

ahh - the logic at the end of this is what I had built out (line extender/intersector/area builder). I'm going to tweak a bit and see where I get. I have a anchored snapper in there too from a previous step....I'm to going run without it and see what happens. Thank you!


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