Skip to main content
Question

Is there any way to use FME Desktop to square (true) polygon corners to 45 or 90 degrees?

  • November 14, 2021
  • 4 replies
  • 201 views

lance
Contributor
Forum|alt.badge.img+5

I have about 500,000 building footprints that are collected to varying degrees of accuracy. I would like to true these footprints so the corners are either 45 or 90 degrees on the polygons as depicted below. Is there a means to do this using FME desktop? The corners are typically within +/- 5 to 10 ground units of being true.

 

Before:

BeforeAfter:After

4 replies

aron
Enthusiast
Forum|alt.badge.img+16
  • Enthusiast
  • December 21, 2021

I was wondering this as well. Does anyone know how it is done?


geomancer
Evangelist
Forum|alt.badge.img+59
  • Evangelist
  • December 21, 2021

Maybe something like this:

  1. Create the 2D Oriented Bounding Box of the feature (BoundingBoxReplacer)
  2. Calculate the azimuth of one side of this Bounding Box
  3. Convert the original polygon to segments of 2 points (Chopper)
  4. Calculate the azimuth of every segment
  5. If the azimuth of a segment is close enough to the azimuth of the bounding box (or close enough to this azimuth +/- 90 or 180 degrees, or - if you want to - close enough to this azimuth +/- 45 degrees or +/- 135 degrees), rotate the segment around it's middle point to the desired azimuth
  6. Calculate the intersection point of every pair of adjacent segments
  7. Re-create the polygon from the intersection points

Ensure the polygons have no corners of (approximately) 180 degrees.

Make sure every original polygon has a unique ID, and use Group By on this ID where this applies.


geomancer
Evangelist
Forum|alt.badge.img+59
  • Evangelist
  • December 22, 2021

An implementation of the process mentioned above (not thoroughly tested!):

Make Rectangular_workspaceThe workspace uses a simplified version of the HorizontalAngleCalculator from FME Hub.


geomancer
Evangelist
Forum|alt.badge.img+59
  • Evangelist
  • January 31, 2025

Somebody asked me for the workspace, so I re-upload it here.

However in retrospect I think the workspace is much more complicated than it needs to be.

A lot of the initial work can be done by the PolylineAnalyzer (FME Hub).