holoviz / spatialpandas

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

Failing tests test_multipolygon_cx_selection #144

Closed hoxbro closed 1 month ago

hoxbro commented 1 month ago

Observed in #142, that the following test is started to fail: test_multipolygon_cx_selection

import geopandas as gpd
from shapely.geometry import shape
from spatialpandas.geometry import MultiPolygonArray

geometry = {"type": "MultiPolygon", "coordinates": [[[[0, 50], [20, 50], [50, 20], [50, 0]]]]}
geometry = {"type": "Polygon", "coordinates": [[[0, 50], [20, 50], [50, 20], [50, 0]]]}
gp_multipolygon = gpd.GeoSeries([shape(geometry)])
xslice, yslice = (slice(None, 0.0, None), slice(50.0, None, None))  # Works if slice is 50.0000001
expected = MultiPolygonArray.from_geopandas(gp_multipolygon.cx[xslice, yslice])
result = MultiPolygonArray.from_geopandas(gp_multipolygon).cx[xslice, yslice]
assert all(expected == result)