Skip to content

fix(geotiff): bound all of a rotated image in GeoTIFF.bbox - #718

Merged
kylebarron merged 1 commit into
mainfrom
kyle/rotated-bbox
Oct 15, 2026
Merged

kylebarron merged 1 commit into
mainfrom
kyle/rotated-bbox

Conversation

@kylebarron

Copy link
Copy Markdown
Member

Note

This PR was written by Claude (Claude Code), not by @kylebarron.

GeoTIFF.bbox passed through @cogeotiff/core's TiffImage.bbox, which is the image's origin plus resolution times its size. resolution reads only the diagonal of ModelTransformation, so for a rotated image the box ran along the axes from the origin corner instead of around the image. getGeographicBounds projects that box, so the geographicBounds that COGLayer and MultiCOGLayer pass to onGeoTIFFLoad covered 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.bbox is now the box around the image's four corners, put through GeoTIFF.transform, the way AffineTilesetLevel computes projectedBounds and rasterio and async-geotiff compute bounds. 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.

transform shifts a PixelIsPoint raster by half a pixel, and cogeotiff's bbox didn't, so for those rasters bbox also moves by half a pixel, onto the pixel edges, matching rasterio. generateTileMatrixSet writes bbox into its boundingBox, but it still rejects rotated transforms, so only the PixelIsPoint change reaches it.

Tests compare bbox with rasterio's bounds for a north-up, a rotated, and a PixelIsPoint fixture, and check getGeographicBounds for the rotated one.

Closes #715

🤖 Written by Claude Code

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]>
@github-actions github-actions Bot added the fix label Oct 15, 2026

@kylebarron kylebarron left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kylebarron
kylebarron merged commit 8f2e857 into main Oct 15, 2026
3 checks passed
@kylebarron
kylebarron deleted the kyle/rotated-bbox branch October 15, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GeoTIFF.bbox ignores a rotated transform, so geographic bounds of rotated images are too small

1 participant