Skip to content

Conversation

@mplough-kobold
Copy link
Contributor

This PR modifies rio cogeo validate to flag GeoTIFFs with modifications known to GDAL to invalidate the optimized layout as invalid COGs. It does so by checking the ghost header, if present.

When I followed up on the discussion created from #258, I figured out that GDAL adds ghost headers to GeoTIFF files. GDAL >= 3.1 marks KNOWN_INCOMPATIBLE_EDITION=YES in ghost headers when it writes out a modified COG file:

This file used to have optimizations in its layout, but those have been, at least partly, invalidated by later changes

With OSGeo/gdal#2832, GDAL reports the content of the ghost header area in a way that's accessible to rasterio, allowing us to easily check its contents.

I verified that get_tag_item returns None if a tag is not present -- so compatibility with non-GDAL COGs is preserved.

@vincentsarago
Copy link
Member

🙏 thanks @mplough-kobold for looking deeper into this!

I think the changes make sense, I'll merge and make a 3.5.2 release 🙏

@vincentsarago vincentsarago self-requested a review May 22, 2023 16:35
@vincentsarago vincentsarago merged commit 12e445c into cogeotiff:main May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants