dwyerk / boundaries

Python code behind the boundaries blog post @ https://web.archive.org/web/20201013181320/http://blog.thehumangeo.com/2014/05/12/drawing-boundaries-in-python/
38 stars 10 forks source link

GEOSGeom_createLineString_r returned a NULL pointer #2

Open NeighborhoodCoding opened 4 years ago

NeighborhoodCoding commented 4 years ago

Hi, I'm running your code... but above error comming out... I just installed geopandas and fiona...



ValueError Traceback (most recent call last)

in 61 return cascaded_union(triangles), edge_points 62 ---> 63 concave_hull, edge_points = alpha_shape(points, alpha=1.87) 64 65 _ = plot_polygon(concave_hull) in alpha_shape(points, alpha) 57 add_edge(edges, edge_points, coords, ic, ia) 58 ---> 59 m = geometry.MultiLineString(edge_points) 60 triangles = list(polygonize(m)) 61 return cascaded_union(triangles), edge_points c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\shapely\geometry\multilinestring.py in __init__(self, lines) 50 pass 51 else: ---> 52 self._geom, self._ndim = geos_multilinestring_from_py(lines) 53 54 def shape_factory(self, *args): c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\shapely\geometry\multilinestring.py in geos_multilinestring_from_py(ob) 132 # add to coordinate sequence 133 for l in range(L): --> 134 geom, ndims = linestring.geos_linestring_from_py(obs[l]) 135 subs[l] = cast(geom, c_void_p) 136 c:\users\owner\appdata\local\programs\python\python36\lib\site-packages\shapely\speedups\_speedups.pyx in shapely.speedups._speedups.geos_linestring_from_py() ValueError: GEOSGeom_createLineString_r returned a NULL pointer -------------------------------------------------------------------------------------- do you know why the error appears?
dwyerk commented 4 years ago

Usually this means that the LineString is invalid. You should inspect the value of edge_points to see if it's a reasonable input to MultiLineString.