cartagen.smooth_platre#
- smooth_platre(geometry, sigma=2, curvature=0.05)#
Smooth a line and preserve the integrity of sharp turns.
The PLATRE algorithm was created by Emmanuel Fritsch [1] to attenuate minor bends in a polyline while preserving the position and integrity of the sharpest turns. Unlike simple coordinate-based filters, it operates on the line’s intrinsic geometry (curvature/angle) to maintain structural consistency.
- Parameters:
geometry (
LineStringorMultiLineString) – The geometry to smooth.sigma (
float, optional) – Strength of the smoothing.curvature (
float, optional) – The curvature threshold to identify sharpest turns. Low values is closer to the original line.
- Returns:
See also
smooth_gaussianSmooth a line or a polygon and attenuate its inflexion points.
smooth_snakeSmooth a line or polygon using the snake method.
smooth_taubinSmooth a line or polygon and prevent shrinkage.
smooth_topographicSmooth a line or polygon and mimic hand-made cartographic generalization.
smooth_wmaSmooth a line or polygon using a low-pass filter.
References
Examples
>>> line = LineString([(0, 0), (1, 1), (2, 0), (5, 3)]) >>> c4.platre(line, sigma=2, curvature=5) <LINESTRING (0 0, 0.9950928016739138 0.6091961570208742, 2.0147215949782598 1.172411528937378, 5 3)>