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 https://github.com/OSGeo/gdal/pull/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.
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:With https://github.com/OSGeo/gdal/pull/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
returnsNone
if a tag is not present -- so compatibility with non-GDAL COGs is preserved.