# Creating concave hull with Python?

I'm trying to follow this tutoriel to do a concave hull script : Drawing Boundaries In Python

Of course, I drop all steps for plot results. But at the and of my script I have an error. This is last lines :

``````edges = set()
edge_points = []

# loop over triangles:
# ia, ib, ic = indices of corner points of the triangle

for ia, ib, ic in tri.vertices:
pa = coords[ia]
pb = coords[ib]
pc = coords[ic]
# Lengths of sides of triangle
a = math.sqrt((pa-pb)**2 + (pa-pb)**2)
b = math.sqrt((pb-pc)**2 + (pb-pc)**2)
c = math.sqrt((pc-pa)**2 + (pc-pa)**2)
# Semiperimeter of triangle
s = (a + b + c)/2.0
# Area of triangle by Heron's formula
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
circum_r = a*b*c/(4.0*area)
#print circum_r
if circum_r < 1.0/alpha:

m = geometry.MultiLineString(edge_points)
triangles = list(polygonize(m))
``````

And it returns :

``````Assertion failed: (!static_cast<bool>("should never be reached")),
function itemsTree, file AbstractSTRtree.cpp, line 373.
Abort trap: 6
``````

What is wrong here?

• Which line exactly triggers that? Do you use a spatial index? – bugmenot123 Jan 23 '18 at 10:12
• The last line is generating this error and more precisely, cascaded_union() fonction... For spatial index, I don't think so. – Tim C. Jan 23 '18 at 10:20
• Seems like a bug! Please see github.com/Toblerity/Shapely/… and try if updating accordingly fixes it. If not, please try to make a bug report with the data that leads to this. :) If this fixes it, please post that as your own answer to this question. – bugmenot123 Jan 23 '18 at 10:44