flatten_polygon#
- zeroheliumkit.src.utils.flatten_polygon(p: Polygon, cut_position: float = None) MultiPolygon[source]#
Creates a cut line along the centroid of each hole and dissects the polygon. 1e6 is the length of the cut line. ## (is this a weird way to say it?)
- Parameters:
p (Polygon) – The input polygon to be flattened.
- Returns:
A MultiPolygon object containing the dissected polygons.
- Return type:
MultiPolygon
Example
>>> polygon = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)], ... interiors=[[(0.2, 0.2), (0.8, 0.2), (0.8, 0.8), (0.2, 0.8)]]) >>> result = flatten_polygon(polygon) >>> print(result) MULTIPOLYGON ...