cartagen.simplify_wang_muller#
- simplify_wang_muller(geometry, tolerance)#
Simplify a line or polygon using a bend-reduction method.
This algorithm proposed by Wang & Müller [1] analyses the bends (curves) of a line or polygon and reduces those whose size falls below a given diameter tolerance, emulating the decisions a cartographer would make when generalising a line by hand. Topology is preserved throughout, a bend is only reduced if doing so does not cause the resulting geometry to self-intersect, cross another feature, or violate sidedness constraints.
This is a translation to work outside QGIS of the reduce bend algorithm of the geo_sim_processing QGIS plugin.
- Parameters:
geometry (
LineString,MultiLineString,Polygon,MultiPolygon,LinearRing) – The geometry to simplify.tolerance (
float) – Theoretical diameter (in the coordinate reference system units) of a bend to remove. Bends whose adjusted area is smaller than the iso-perimetric equivalent of a circle with this diameter are candidates for reduction. A good rule of thumb for cartographic generalisation is to use 0.5 mm at the target map scale (e.g.tolerance = 25for a 1:50 000 map in metres). Higher values = more aggressive simplification.
- Returns:
LineString,MultiLineString,Polygon,MultiPolygon,LinearRing– Simplified geometry of the same type as the input.
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_visvalingam_whyattSimplify a line or polygon using an area-based selection.
simplify_whirlpoolSimplify a line or polygon using an epsilon-circle based selection.
References
Examples
>>> line = LineString([(0, 0), (1, 0.5), (2, 0), (3, 0.2), (10, 0)]) >>> simplify_wang_muller(line, 2.0) <LINESTRING (0 0, 10 0)>