TransWikia.com

Creating a linestring from points using shapely

Geographic Information Systems Asked on November 28, 2020

I am creating a linestring from points using shapely, but I could not generate the linestring using the points on my local system. This code is running fine on Google Colab. Is there any package dependency which I don’t 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:python37libsite-packagesshapelygeometrylinestring.py in __init__(self, coordinates)
     46         BaseGeometry.__init__(self)
     47         if coordinates is not None:
---> 48             self._set_coords(coordinates)
     49 
     50     @property

c:python37libsite-packagesshapelygeometrylinestring.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:python37libsite-packagesshapelyspeedups_speedups.pyx in shapely.speedups._speedups.geos_linestring_from_py()

ValueError: GEOSGeom_createLineString_r returned a NULL pointer

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP