cartagen.regularize_building_regression#
- regularize_building_regression(polygon, sigma)#
Regularize a polygon using recursive linear regression.
This algorithm was proposed by Bayer [1] and used for remote sensing building regularization in Yang. [2] It first defines the four sides of the polygon using an enclosing rectangle that has one side touching the side of the polygon. Then, every side is recursively subdivided until the standard deviation of the vertex composing the side is below the provided threshold. The standard deviation is calculated using the horizontal or vertical regression line which will output a squared polygon.
- Parameters:
- Returns:
See also
enclosing_rectangleConstruct an enclosing rectangle from a polygon.
regularize_building_rectangleTransform a polygon into a rectangle.
regularize_building_ferRegularize a polygon using feature edge reconstruction.
Notes
This algorithm always squares the provided polygon, this can create strange results when using on polygons that are not supposed to be square.
References
Examples
>>> polygon = Polygon([(0, 0), (0, 2), (1, 2), (1, 1), (2, 1), (2, 0), (0, 0)]) >>> regularize_building_regression(polygon, 1.0) <POLYGON ((0 0, 0 2, 1.5 2, 1.5 0, 0 0))>