cartagen.simplify_visvalingam_whyatt#
- simplify_visvalingam_whyatt(geometry, threshold=None, number=None, ratio=None)#
Simplify a line or polygon using an area-based selection.
This algorithm proposed by Visvalingam and Whyatt [1] performs a line simplification that produces less angular results than the filtering algorithm of Ramer-Douglas-Peucker. The principle of the algorithm is to select the vertices to delete (the less characteristic ones) rather than choosing the vertices to keep (in the Douglas and Peucker algorithm). To select the vertices to delete, there is an iterative process, and at each iteration, the triangles formed by three consecutive vertices are computed. If the area of the smallest triangle is smaller than a threshold, the middle vertex is deleted, and another iteration starts.
The algorithm is relevant for the simplification of natural line or polygon features such as rivers, forests, or coastlines. This implementation was made by Elliot Hallmark.
- Parameters:
geometry (
LineString,MultiLineString,Polygon,MultiPolygon,LinearRing) – The geometry to simplify.threshold (
float, optional) – The minimum triangle area to keep a vertex in the line. Higher values = more points kept (less aggressive simplification).number (
int, optional) – The target number of points to keep in the simplified line.ratio (
float, optional) – The ratio of points to keep (between 0 and 1). Example: 0.5 keeps approximately 50% of the original points.
- Returns:
LineString,MultiLineString,Polygon,MultiPolygon,LinearRing
See also
simplify_angularSimplify a line or polygon by removing vertexes with small angles.
simplify_douglas_peuckerSimplify a line or polygon using a distance-based selection.
simplify_langSimplify a line or polygon using a look-ahead distance-based selection.
simplify_li_openshawSimplify a line or a polygon using a regular grid.
simplify_raposoSimplify a line or a polygon using an hexagonal tessellation.
simplify_reumann_witkamSimplify a line or polygon using a directional distance-based selection.
simplify_wang_mullerSimplify a line or polygon using a bend-reduction method.
simplify_whirlpoolSimplify a line or polygon using an epsilon-circle based selection.
References
Examples
>>> line = LineString([(0, 0), (1, 1), (2, 0), (5, 3)]) >>> simplify_visvalingam_whyatt(line, threshold=5.0) <LINESTRING (0 0, 2 0, 5 3)>