cartagen.open_polygon

Contents

cartagen.open_polygon#

open_polygon(polygon, size, quad_segs=1)#

Open a polygon using erosion and dilation.

This algorithm relies on the successive erosion and dilation of a polygon to get rid of thin sections.

Parameters:
  • polygon (Polygon or MultiPolygon) – The polygon to close.

  • size (float) – The size of the erosion and dilation.

  • quad_segs (int) – The number of linear segments in a quarter circle when performing the buffer. If above 1, the result may have round corners unsuitable for buildings.

Returns:

Polygon or MultiPolygon

See also

close_polygon

Close a polygon using dilation and erosion.

Examples

>>> polygon = Polygon([(0, 0), (0, 4), (4, 4), (4, 0), (0, 0)])
>>> open_polygon(polygon, 1)
<POLYGON ((0 1, 1 4, 4 3, 3 0, 0 1))>

(Source code)

../_images/open_polygon.png