Skip to content
Snippets Groups Projects
Commit 1fef2ffa authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: minor improvement to splitting

parent 966cfcf1
No related branches found
No related tags found
1 merge request!6Clhp map
No preview for this file type
...@@ -106,15 +106,12 @@ def cut_polygon_in_two(polygon: Polygon, divisor: float, horizontal: bool): ...@@ -106,15 +106,12 @@ def cut_polygon_in_two(polygon: Polygon, divisor: float, horizontal: bool):
if len(split_shape) < 3: if len(split_shape) < 3:
print("Not enough coordinates to create valid polygons: Split shape") print("Not enough coordinates to create valid polygons: Split shape")
split_shape = None split_shape = None
else:
split_shape.append(split_shape[0]) # NB: may not be necessary?
# Check if the remaining_shape has enough coordinates to create a polygon # Check if the remaining_shape has enough coordinates to create a polygon
if len(remaining_shape) < 3: if len(remaining_shape) < 3:
print("Not enough coordinates to create valid polygons: Remaining shape") print("Not enough coordinates to create valid polygons: Remaining shape")
remaining_shape = None remaining_shape = None
else:
remaining_shape.append(remaining_shape[0])
# Return split polygons as Shapely Polygon objects # Return split polygons as Shapely Polygon objects
return Polygon(split_shape), Polygon(remaining_shape) return Polygon(split_shape), Polygon(remaining_shape)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment