Shapely unary_union on 5 or more Polygons results in empty GeometryCollection

2.1k views Asked by At

can anyone tell me why unary_union on a sequence of 5 or more Polygons returns an empty GeometryCollection:

import numpy as np
from shapely.ops import unary_union
from shapely.geometry import Polygon

x = np.array([0, 0, 1, 1, 0], dtype=float)
y = np.array([0, 1, 1, 0, 0], dtype=float)
polygons = []
for i in range(5):
    polygons.append(Polygon(list(zip(x, y))))
    x += 1
un = unary_union(polygons)

while 4 or less Polygons returns a Polygon as expected?

polygons = []
for i in range(4):
    polygons.append(Polygon(list(zip(x, y))))
    x += 1
un2 = unary_union(polygons)
0

There are 0 answers