Skip to content

split between lines throws a "ValueError" #952

@liberostelios

Description

@liberostelios

Expected behavior and actual behavior.

This is supposed to conduct a split of a LineString from a MultiLineString. If the latter is exported as WKT and then parsed back to a geometry, then split works fine. But otherwise, an exeption is thrown:

~/Dropbox/TU Delft/PhD Thesis/22 - Roads dataset/src/venv/lib/python3.7/site-packages/shapely/ops.py in split(geom, splitter)
    482             raise ValueError("Splitting %s geometry is not supported" % geom.type)
    483 
--> 484         return GeometryCollection(split_func(geom, splitter))
    485 
    486 split = SplitOp.split

~/Dropbox/TU Delft/PhD Thesis/22 - Roads dataset/src/venv/lib/python3.7/site-packages/shapely/geometry/collection.py in __init__(self, geoms)
     40             pass
     41         else:
---> 42             self._geom, self._ndim = geos_geometrycollection_from_py(geoms)
     43 
     44     @property

~/Dropbox/TU Delft/PhD Thesis/22 - Roads dataset/src/venv/lib/python3.7/site-packages/shapely/geometry/collection.py in geos_geometrycollection_from_py(ob)
     57 def geos_geometrycollection_from_py(ob):
     58     """Creates a GEOS GeometryCollection from a list of geometries"""
---> 59     L = len(ob)
     60     N = 2
     61     subs = (c_void_p * L)()

TypeError: object of type 'LineString' has no len()

Steps to reproduce the problem.

ga = shapely.wkt.loads("LINESTRING (83630.05839620145 455278.7190089315, 83694.24488269491 455322.0302266635)")
gb = shapely.wkb.loads(b'\x01\x05\x00\x00\x00\x06\x00\x00\x00\x01\x02\x00\x00\x00\x04\x00\x00\x00\xe1f\xe1\xe3\x89j\xf4@\x15\x9fGX\xda\xc9\x1bA>\xb6J\xfdbj\xf4@\xa3=\xac\xc1\xce\xc9\x1bA\xb2\xc2B\xd5\xa7j\xf4@\x81\x98"\xde\xb5\xc9\x1bA\xf7\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\x01\x02\x00\x00\x00\x02\x00\x00\x00\xf7\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\xf8\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\x01\x02\x00\x00\x00\x04\x00\x00\x00\xf8\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\x9a\x8b\xc7\xd5\x07k\xf4@\x0bB\xdfv\xc6\xc9\x1bA&\x7f\xcf\xfd\xc2j\xf4@-\xe7hZ\xdf\xc9\x1bA\xe1f\xe1\xe3\x89j\xf4@\x15\x9fGX\xda\xc9\x1bA\x01\x02\x00\x00\x00\x02\x00\x00\x00\xed5Z\xb9\x95j\xf4@\xbb\x94\x1f&\xae\xc9\x1bA\xf7\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\x01\x02\x00\x00\x00\x02\x00\x00\x00\xe1Q\xc6\xc8rl\xf4@\xee\nc\x07\x1d\xc9\x1bA\xf8\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\x01\x02\x00\x00\x00\x02\x00\x00\x00\xf8\xda0\xef\xe0j\xf4@\x99\xe0C\xe0\xba\xc9\x1bA\xf7\xda0\xef\xe0j\xf4@\x9a\xe0C\xe0\xba\xc9\x1bA')

shapely.ops.split(ga, gb)

Operating system

macOS 10.15.5

Shapely version and provenance

Version 1.7.0 installed with pip.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions