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

Wrong bounds on multi-band raster #26

Closed
lucabaldassarre opened this issue Feb 7, 2018 · 6 comments
Closed

Wrong bounds on multi-band raster #26

lucabaldassarre opened this issue Feb 7, 2018 · 6 comments

Comments

@lucabaldassarre
Copy link

I have a raster with 8 bands that I load via:

raster = '../../Data/21-Mar-2016_part1.tif'
data = gr.from_file(raster)

The data shape is (8, 3485, 3617).
The bounds I obtain via data.bounds is not correct because it does not use the correct shape size.

data.bounds
(-49.061416, -22.462534226398855, -48.72194693862317, -22.461815)

While

geot = data.geot
shape = data.shape
geot[3]+geot[5]*shape[1]

returns the correct value of -22.775128 instead of -22.462534226398855 and

geot[0]+geot[1]*shape[2]

returns the correct value of -48.709089 instead of -48.72194693862317.
Perhaps, the bounds method need to be modified as to be aware which axis corresponds to x and y and not to the band?

@ozak
Copy link
Owner

ozak commented Feb 7, 2018

Can you share this file? I'll try to take a look and solve this today.

@lucabaldassarre
Copy link
Author

The file is quite big (200mb), but the issue does not appear when using a single-band raster.

@ozak
Copy link
Owner

ozak commented Feb 7, 2018

Ok. I am modifying the code so one can choose the band (at least in some parts), but it seems the main function used to load the data gdalnumeric.LoadFile does not have a way to choose the band. This may require a change to another function or package like rasterio. I want to move towards using rasterio #3, but have not had the time.

@ozak
Copy link
Owner

ozak commented Feb 7, 2018

If you have a smaller file you can share so I can play with it, it would be useful.

@lucabaldassarre
Copy link
Author

I resampled my file, it is now 32mb.

sample_image.tar.gz

@ozak
Copy link
Owner

ozak commented May 28, 2020

I will close this and open an enhancement request for multiband rasters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants