cogeotiff / rio-cogeo

Cloud Optimized GeoTIFF creation and validation plugin for rasterio
https://cogeotiff.github.io/rio-cogeo/
BSD 3-Clause "New" or "Revised" License
308 stars 42 forks source link

COG validation fails for files that are SPARSE and have sparse edge tiles in the overviews. #281

Closed mpadillaruiz closed 6 months ago

mpadillaruiz commented 7 months ago

I am using the rio-cogeo validator to validate a sparse COG file and the validation returns False even though it is a valid COG. Other COG validators return valid for the same file.

I believe this is because the overviews are stored as sparse and the validator checks for the first tile offset of each overview (BLOCK_OFFSET_0_0 tag). Since there are sparse edge tiles, this value it is zero, and it cannot verify that the overviews are in the right order, even though they are.

Is this a limitation of the validator? Is there a way to overcome this issue or is it planned to be fixed?

Thank you.

vincentsarago commented 7 months ago

👍 Yes I think we should fix this! Do you have an example of file you could create or share? 🙏

mpadillaruiz commented 7 months ago

Hi @vincentsarago Here is a link to the file I have been testing with https://drive.google.com/file/d/1urWkrF0qY-JZ54souDdj5gljsL5CLivZ/view?usp=sharing

I get the following error with the validator:

COG Validation info
    - The offset of the first block of overview of index 1 should be after the one of the overview of index 2 (error)

Note that the overviews and full image are in the right order if you ignore the sparse zero blocks:

fullimage overview1 overview2 overview3 overview4
mpadillaruiz commented 7 months ago

Hi @vincentsarago , I opened a PR for this fix. I was not able to add reviewers but please let me know if there is some other procedure I need to follow.

Thank you!

vincentsarago commented 6 months ago

this was done in #282