Squares up polygons that have noisy, slanted or jagged edges, such as building footprints extracted from LiDAR or imagery, or hand-digitised outlines.
For each polygon the dominant direction of its edges is found, every edge is snapped to that direction or to 90 degrees from it (optionally also 45 degrees), and the edges are re-connected into a clean orthogonal outline. Holes are regularized too. Polygons that are nearly circular can be replaced by true circles, and neighboring polygons can be aligned to a common direction.
Pure Python on FME's own geometry objects: nothing to install, works on FME Form and FME Flow.
Output is one feature per resulting polygon. A polygon with several parts, or one that splits while being straightened, yields several features.
The method follows the Building-Regulariser library (https://github.com/DPIRD-DMA/Building-Regulariser, MIT license), re-implemented without its numpy, shapely and geopandas dependencies.
Ports
Input
Area features (polygons, donuts, multi-areas). Output geometry is 2D.
Regularized
The straightened polygons. Attributes added: _regularized_shape (orthogonal or circle), _main_direction (dominant edge direction in degrees counter-clockwise from the X axis, 0 to 89 for most features; with neighbor alignment the direction aligned to) and _iou (overlap with the original, from 0 to 1: a quick quality score, so low values are worth a look).
Rejected
Features that could not be regularized. fme_rejection_code is NOT_AN_AREA (no geometry, or not a straight-edged area) or NOT_REGULARIZED (the polygon is too small or too irregular to give a sensible result; the original geometry is passed through unchanged).
Parameters
All distances are in the units of the coordinate system, so use a projected (metric) coordinate system, not latitude/longitude.
Allowed Edge Angles: right angles only, or also 45 degree diagonals.
Diagonal Reluctance: with 45 degree diagonals allowed, how strongly edges are discouraged from becoming diagonal. Larger values give fewer diagonals (0 to 22.5).
Simplify Tolerance: vertices closer than this to a straight line are dropped before straightening. Aim for 2 to 3 times the pixel size of the source raster, or the point spacing of the source point cloud. Also sets the size of the smallest feature detail that survives. 0 switches simplification off.
Parallel Edge Merge Distance: parallel edges closer together than this are merged into one line. Larger values remove small steps and notches.
Detect Circles / Circle Match Threshold: a polygon whose overlap (intersection over union) with the circle of the same area exceeds the threshold is replaced by that circle. Raise the threshold, or switch detection off, if rounded buildings turn into circles.
Align With Neighboring Features: rotates each polygon to the dominant direction of the polygons within the search distance, when that is within the maximum rotation of its own direction. Weighted by outline length. Makes rows of houses line up. This setting holds all features in memory until the last one arrives.
Notes
Features are processed one at a time unless neighbor alignment is on.
The right-angle snapping differs from Building-Regulariser 0.3.0, whose right-angles-only mode sends edges that run opposite to the main direction to the wrong class and shrinks even a perfect rectangle. With 45 degree diagonals allowed the two give practically identical results.
Legal
The method follows the Building-Regulariser library (https://github.com/DPIRD-DMA/Building-Regulariser), adapted for FME without its numpy, shapely, and geopandas dependencies. This transformer is an independent adaptation and is not officially endorsed or maintained by DPIRD-DMA.
Original Copyright & MIT License Notice
MIT License
Copyright (c) 2025 DPIRD-DMA
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Would you like to know more? Click here to find out more details!

