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

UnionDataset does not propagate .res #1341

Closed
jatentaki opened this issue May 16, 2023 · 1 comment · Fixed by #1344
Closed

UnionDataset does not propagate .res #1341

jatentaki opened this issue May 16, 2023 · 1 comment · Fixed by #1344
Assignees
Labels
datasets Geospatial or benchmark datasets
Milestone

Comments

@jatentaki
Copy link

Description

TLDR: setting .res on UnionDataset should set it for all children.

A problematic scenario: assume a is a raster dataset with res=1 and b, c are vector datasets with res=0.0001. We want a union with res=1. If we write

ab = a | b
abc = ab | c

b will be cast to res of a and then c to resolution of ab -> all datasets have the same res=1. However if we write

bc = b | c
abc = a | bc

we will create bc with res=0.0001 and then cast it to the res of a. But since res is just a member variable of bc, it doesn't run any code to propagate down to b and c. When we query resulting abc we will get answers at differing resolutions, which in my case crashes the kernel with an attempt of rasterizing b and c at ridiculously high resolutions.

Steps to reproduce

I hope the analysis above is sufficient to understand the issue. I can provide a runnable repro if I am pointed to a way to reasonably generate fake data (I'm not sure how to do it best, such that the fake vector and raster datasets overlap and agree on metadata).

Version

torchgeo==0.4.1

@adamjstewart adamjstewart self-assigned this May 16, 2023
@adamjstewart adamjstewart added this to the 0.4.2 milestone May 16, 2023
@adamjstewart
Copy link
Collaborator

I'm able to reproduce this bug. I believe it affects both res and crs for both IntersectionDataset and UnionDataset. Working on a fix and better testing now.

@adamjstewart adamjstewart added the datasets Geospatial or benchmark datasets label May 18, 2023
@adamjstewart adamjstewart modified the milestones: 0.4.2, 0.5.0 Sep 28, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants