Repository navigation
fix(geotiff): bound all of a rotated image in GeoTIFF.bbox - #718
Merged
Merged
Conversation
GeoTIFF.bbox passed through @cogeotiff/core's TiffImage.bbox, which reads only the diagonal of ModelTransformation, so a rotated image's box ran along the axes from its origin corner instead of around the image. Compute it from GeoTIFF.transform as the box around the image's four corners. This also puts a PixelIsPoint image's box on its pixel edges, as rasterio does. Closes #715 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was written by Claude (Claude Code), not by @kylebarron.
GeoTIFF.bboxpassed through@cogeotiff/core'sTiffImage.bbox, which is the image's origin plusresolutiontimes its size.resolutionreads only the diagonal ofModelTransformation, so for a rotated image the box ran along the axes from the origin corner instead of around the image.getGeographicBoundsprojects that box, so thegeographicBoundsthatCOGLayerandMultiCOGLayerpass toonGeoTIFFLoadcovered only part of a rotated image: in cog-basic, the fly-to for the Umbra Port of Rotterdam COG showed only a corner of it.GeoTIFF.bboxis now the box around the image's four corners, put throughGeoTIFF.transform, the wayAffineTilesetLevelcomputesprojectedBoundsand rasterio and async-geotiff computebounds. For the Umbra COG it grows from[4.2369, 51.8541, 4.2739, 51.8770]to[4.2369, 51.8541, 4.3364, 51.9157], and the fly-to frames the whole image.transformshifts aPixelIsPointraster by half a pixel, and cogeotiff'sbboxdidn't, so for those rastersbboxalso moves by half a pixel, onto the pixel edges, matching rasterio.generateTileMatrixSetwritesbboxinto itsboundingBox, but it still rejects rotated transforms, so only thePixelIsPointchange reaches it.Tests compare
bboxwith rasterio's bounds for a north-up, a rotated, and aPixelIsPointfixture, and checkgetGeographicBoundsfor the rotated one.Closes #715
🤖 Written by Claude Code