Skip to content

Add geometry simplification to polygonize()#1176

Merged
brendancol merged 8 commits intomasterfrom
issue-1151
Apr 8, 2026
Merged

Add geometry simplification to polygonize()#1176
brendancol merged 8 commits intomasterfrom
issue-1151

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

  • Add simplify_tolerance and simplify_method parameters to polygonize()
  • Two algorithms: Douglas-Peucker (distance-based) and Visvalingam-Whyatt (area-based)
  • Shared-edge decomposition means adjacent polygons get the same simplified boundary, so no gaps or overlaps
  • All backends (numpy, cupy, dask+numpy, dask+cupy) and all return types

Closes #1151

Test plan

  • DP kernel: straight line, bend preservation, sub-tolerance removal, two-point input
  • VW kernel: straight line, large/small triangle area, two-point input
  • Shared-edge topology: vertex reduction, area preservation, shared edge identity
  • API validation: tolerance=None, tolerance=0, negative tolerance, bad method string
  • Both algorithms reduce vertices on staircase boundaries
  • Total area preserved after simplification
  • column and polygon_points stay in sync when degenerate polygons get dropped
  • All return types (geopandas, geojson, spatialpandas, awkward)
  • Dask produces same areas as numpy for both DP and VW
  • CuPy produces same areas as numpy
  • Edge cases: holes, affine transform, single-pixel raster
  • Backward compatible (all 77 existing tests still pass)

@github-actions github-actions bot added the performance PR touches performance-sensitive code label Apr 7, 2026
@brendancol brendancol merged commit 06e1025 into master Apr 8, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add geometry simplification option to polygonize()

1 participant