Skip to content

Add geometry simplification option to polygonize() #1151

@brendancol

Description

@brendancol

polygonize() exists but produces exact pixel-boundary polygons. On high-resolution rasters this creates extremely dense geometries with thousands of vertices per polygon, making the output impractical for downstream use (slow rendering, large file sizes, unwieldy for spatial joins).

Scope

  • Add a simplify_tolerance parameter to polygonize() that applies Douglas-Peucker simplification during or after polygon generation. Tolerance should be in the raster's coordinate units.
  • Optional: Visvalingam-Whyatt as an alternative simplification algorithm, which tends to produce better results for cartographic output.
  • Topology preservation: adjacent polygons shouldn't develop gaps or overlaps after simplification. This is the hard part. A shared-edge approach (simplify edges rather than individual polygons) would handle it, or at minimum a flag to warn users when topology isn't guaranteed.

Why this matters

This matters most for land cover and classification outputs where polygonize() is used to create vector deliverables. The current workaround is GDAL's gdal_polygonize.py followed by ogr2ogr -simplify, which adds a GDAL dependency and an intermediate file. Having simplification built into polygonize() keeps the workflow self-contained.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions