cartagen.smooth_platre

Contents

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 (LineString or MultiLineString) – 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:

LineString, MultiLineString

See also

smooth_gaussian

Smooth a line or a polygon and attenuate its inflexion points.

smooth_snake

Smooth a line or polygon using the snake method.

smooth_taubin

Smooth a line or polygon and prevent shrinkage.

smooth_topographic

Smooth a line or polygon and mimic hand-made cartographic generalization.

smooth_wma

Smooth 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)>

(Source code)

../_images/smooth_platre.png