Skip to main content
1 of 2
SWAT
  • 141
  • 3
  • 14

creating a line string from points using shapely

I am creating a line string from points using shapely, but I could not generate the line string using the points on my local system, but this code is running fine on google colab, is there any package dependency which i dont have installed on my system?

import shapely
from shapely import speedups
from shapely import geometry
from shapely.geometry import shape, Point, LineString, Polygon

a = LineString([(0, 0), (1, 1), (1,2), (2,2)])
a

Error massage 
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-18-02826fee6746> in <module>
----> 1 a = LineString([(0, 0), (1, 1), (1,2), (2,2)])
      2 a

c:\python37\lib\site-packages\shapely\geometry\linestring.py in __init__(self, coordinates)
     46         BaseGeometry.__init__(self)
     47         if coordinates is not None:
---> 48             self._set_coords(coordinates)
     49 
     50     @property

c:\python37\lib\site-packages\shapely\geometry\linestring.py in _set_coords(self, coordinates)
     95     def _set_coords(self, coordinates):
     96         self.empty()
---> 97         ret = geos_linestring_from_py(coordinates)
     98         if ret is not None:
     99             self._geom, self._ndim = ret

c:\python37\lib\site-packages\shapely\speedups\_speedups.pyx in shapely.speedups._speedups.geos_linestring_from_py()

ValueError: GEOSGeom_createLineString_r returned a NULL pointer
SWAT
  • 141
  • 3
  • 14