Repository navigation
docs: queries return MultiPolygons whole - #1265
Merged
Merged
Conversation
bounding_box_query and polygon_query without clip keep every component of a MultiPolygon that intersects the query region, including components entirely outside of it. Say so, and point to polygon_query(clip=True). Fixes scverse#1255
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1265 +/- ##
=======================================
Coverage 91.43% 91.43%
=======================================
Files 53 53
Lines 8395 8395
=======================================
Hits 7676 7676
Misses 719 719
🚀 New features to boost your workflow:
|
LucaMarconato
pushed a commit
that referenced
this pull request
Nov 11, 2026
Querying a labels element that is annotated by a table, but whose cropped area contains none of the annotated instances, crashes `polygon_query` and `bounding_box_query` with `IndexError: list index out of range` in `_region_as_str_if_list_of_len_one`, which reads the first element of an empty region list. The helper now only unwraps a list of length one. A left join with no matching rows returns an empty table with `region == []`, as the docstring and the storage format spec describe, and the query callers already drop empty tables, so the query keeps the labels and drops the table. The exclusive and right joins use the same helper, so they're covered too. Thanks to @jan-glx for the suggestion. It's also the random failure of `test_attributes_are_copied[labels2d-*]` in the pre-release job on #1265. The labels there come from the shared `RNG` in `conftest.py`, so whether the small query box contains an annotated instance depends on which tests ran before on the same worker. Added a test that builds that case on purpose. Also addresses the left join part of #1226. --------- Co-authored-by: Jan Gleixner <[email protected]>
LucaMarconato
enabled auto-merge (squash)
November 11, 2026 12:26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1255
Documents that
bounding_box_queryandpolygon_querywithoutclipreturn shapes whole, including MultiPolygon components entirely outside the query region, and points topolygon_query(clip=True)withshapely.box(...)for cutting them.