cartagen.generalize_area_patches#
- generalize_area_patches(polygons, scaling, initial_scale=25000, final_scale=50000, level=1, closeness=None, max_reselect_iterations=5, area_tolerance=0.2)#
Generalise area patches using enlargement and contraction.
This algorithm, proposed by Müller and Wang [1], simplifies area patches by enlarging or contracting them according to their relative size, then eliminating, reselecting, merging, displacing, and simplifying the survivors.
This algorithm can be used for patches of vegetation for example, but also for islands, or any areal geographic entities.
- Parameters:
polygons (
GeoDataFrameofPolygonorMultiPolygon) – Input patches in projected coordinates (metres). MultiPolygon rows are supported and are reassembled after generalisation.scaling (
float) – User-defined maximum blanket width in mm on the source map (= t* in eq. 2). Internally converted to ground units asscaling × 1e-3 × initial_scale.initial_scale (
int) – Denominator of the source map scale (M_s). Default 25 000.final_scale (
int) – Denominator of the target map scale (M_t). Default 50 000.level (int
{1, 2, 3, 4}) – Radical-law selection model (I–IV in the paper). Lower values are more selective (fewer patches retained); higher values are less selective. The reselect loop may adjust this automatically.closeness (
floatorNone) – Distance threshold in ground units. Patches closer than this value are subject to spatial constraints (see step 6).Nonedisables the spatial-constraint step entirely.max_reselect_iterations (
int) – Maximum number of reselect feedback iterations (default 5).area_tolerance (
float) – Fractional tolerance on total patch area for the reselect loop (e.g. 0.05 = 5 %).
- Returns:
GeoDataFrame– Generalised patches with Polygon or MultiPolygon geometries and an updatedareacolumn, in the same CRS as the input.
References