holoviz / spatialpandas

Pandas extension arrays for spatial/geometric operations
BSD 2-Clause "Simplified" License
308 stars 25 forks source link

linearrings TypeError using shapely 2.0 #102

Closed ianthomas23 closed 1 year ago

ianthomas23 commented 1 year ago

Running CI using the recently released shapely 2.0 reveals two failures:

spatialpandas/tests/geometry/test_to_geopandas.py::test_polygon_array_to_geopandas FAILED                    [ 85%]
spatialpandas/tests/geometry/test_to_geopandas.py::test_multipolygon_array_to_geopandas FAILED               [100%]

with the error message

E           TypeError: ufunc 'linearrings' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
E           Falsifying example: test_polygon_array_to_geopandas(
E               gp_polygon=0    POLYGON ((-40.58410 -3.68172, -25.93910 27.960...
E               dtype: geometry,
E           )

../../.miniconda/envs/sp/lib/python3.10/site-packages/shapely/creation.py:173: TypeError

This is a spatialpandas bug rather than a shapely one, caused by some inappropriate of np.asarray(..., dtype=object) which was introduced recently to address numpy deprecation warnings about converting ragged arrays.

ianthomas23 commented 1 year ago

Fixed by #103.