holoviz / spatialpandas

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

Fix shapely deprecation warnings #85

Closed ianthomas23 closed 2 years ago

ianthomas23 commented 2 years ago

Running the tests results in a large number of shapely deprecations warnings of these types:

ShapelyDeprecationWarning: __getitem__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the `geoms` property instead to get the  number of parts of a multi-part geometry.
ShapelyDeprecationWarning: Accessing the 'ctypes' attribute is deprecated, and will not be possible any more in Shapely 2.0
ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
ShapelyDeprecationWarning: The 'cascaded_union()' function is deprecated. Use 'unary_union()' instead.

This PR follows the advice contained in those warnings so that they no longer occur.

I still see 3 test failures but they are all parquet-related, presumably issue #84.

ianthomas23 commented 2 years ago

This needs an existing maintainer to approve the CI.

jorisvandenbossche commented 2 years ago

Those APIs have always existed, so a lower bound should (AFAIK) not be needed.

From a quick look, seems all good!

ianthomas23 commented 2 years ago

I've checked the test failures and they are indeed the 3 parquet-related failures. There is also this on Python 3.6:

INTERNALERROR> Hypothesis 6.35.1 requires Python 3.7 or later.

I presume that support for Python 3.6 will be dropped soon? I note that numpy have already dropped support for 3.7.

ianthomas23 commented 2 years ago

Merging this as it successfully removes the Shapely warnings.