Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix len for empty GeoDataset #374

Merged
merged 1 commit into from
Jan 29, 2022
Merged

Fix len for empty GeoDataset #374

merged 1 commit into from
Jan 29, 2022

Conversation

adamjstewart
Copy link
Collaborator

When trying to compute the length of an empty GeoDataset, instead of returning 0, rtree crashes. See Toblerity/rtree#204 for a description of the issue. We can instead use Index.get_size() which has a try-except that happens to catch this issue and return 0.

Index.get_size() is undocumented and was added in rtree 0.9.4, which is relatively new. We could instead add our own try-except with the same implementation as Index.get_size() if we want to support older versions of rtree. Thoughts on this?

@github-actions github-actions bot added datasets Geospatial or benchmark datasets testing Continuous integration testing labels Jan 28, 2022
@adamjstewart adamjstewart added this to the 0.2.1 milestone Jan 28, 2022
@calebrob6
Copy link
Member

I have no problem with 0.9.4! 0.9.0 was late 2019, anything earlier than that was 2016ish

image

@adamjstewart adamjstewart merged commit 60009b3 into main Jan 29, 2022
@adamjstewart adamjstewart deleted the fixes/empty-len branch January 29, 2022 18:26
adamjstewart added a commit that referenced this pull request Mar 19, 2022
yichiac pushed a commit to yichiac/torchgeo that referenced this pull request Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasets Geospatial or benchmark datasets testing Continuous integration testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants