Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaMarconato committed Sep 20, 2023
1 parent 4cd0efb commit 232165e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/spatialdata/_core/query/spatial_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,11 +761,15 @@ def polygon_query(
# TODO: the performance for this case can be greatly improved by using the geopandas queries only once, and not
# in a loop as done preliminarily here
if points or images or labels:
raise NotImplementedError(
"points=True, images=True and labels=True are not implemented when querying by multiple polygons. "
"If you encounter this error, please"
" open an issue on GitHub and we will prioritize the implementation."
logger.warning(
"Spatial querying of images, points and labels is not implemented when querying by multiple polygons "
'simultaneously. You can silence this warning by setting "points=False, images=False, labels=False". If '
"you need this implementation please open an issue on GitHub and we will prioritize the implementation."
)
points = False
images = False
labels = False

sdatas = []
for polygon in tqdm(polygons):
try:
Expand Down
6 changes: 5 additions & 1 deletion tests/core/query/test_spatial_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,11 @@ def test_polygon_query_shapes(sdata_query_aggregation):
circle_pol = circle.buffer(sdata["by_circles"].radius.iloc[0])

queried = polygon_query(
values_sdata, polygons=polygon, target_coordinate_system="global", shapes=True, points=False
values_sdata,
polygons=polygon,
target_coordinate_system="global",
shapes=True,
points=False,
)
assert len(queried["values_polygons"]) == 4
assert len(queried["values_circles"]) == 4
Expand Down

0 comments on commit 232165e

Please sign in to comment.