Skip to content

Error: Points of LinearRing do not form a closed linestring #7

@jrdalenberg

Description

@jrdalenberg

I was trying out this tool and ran into an error in the polygons.parquet file.

Inference ran successfully

[2025-09-04 11:39:36 (43697) - turing_segment - INFO]: Detected 20860 inner cell (fully within unique region, no duplication)
[2025-09-04 11:39:36 (43697) - turing_segment - INFO]: Processed 7000 marginal cells, resulting in 5700 unique cells after deduplication in 0.4529554843902588 seconds
[2025-09-04 11:39:36 (43697) - turing_segment - INFO]: Done segmentation. Found 26560 cells
[2025-09-04 11:39:36 (43697) - turing_segment - INFO]: Done exporting metadata to results/metadata.json
[2025-09-04 11:39:36 (43697) - turing_segment - INFO]: Done exporting to results

I tried reading the data with Geopandas

import geopandas as gpd
data = gpd.read_parquet("results/polygons.parquet")

It gives me the following error:

File ~/miniconda3/envs/turing_segment/lib/python3.10/site-packages/shapely/io.py:353, in from_wkb(geometry, on_invalid, **kwargs)
    349 # ensure the input has object dtype, to avoid numpy inferring it as a
    350 # fixed-length string dtype (which removes trailing null bytes upon access
    351 # of array elements)
    352 geometry = np.asarray(geometry, dtype=object)
--> 353 return lib.from_wkb(geometry, invalid_handler, **kwargs)

GEOSException: IllegalArgumentException: Points of LinearRing do not form a closed linestring

My best guess is that a polygon shape validation is missing before saving the data to disk.

Versions:
shapely: 2.1.1
geopandas: 1.1.1
turing_segment: 0.3.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions