geotiff.js icon indicating copy to clipboard operation
geotiff.js copied to clipboard

getResolution returns wrong resolution for rotated rasters

Open AsgerPetersen opened this issue 3 years ago • 2 comments

This code https://github.com/geotiffjs/geotiff.js/blob/4de2c3deb2e751809afada6546330462b9406ae6/src/geotiffimage.js#L859-L861 is only correct when the raster is CRS aligned (ie "not rotated"). If the raster is not CRS aligned the calculated resolution has nothing to do with the actual resolution. It may for instance be 0 or negative. Leading to very strange behaviour like throwing "resolutions must be sorted in descending order"

This old PR against rasterio may be used as inspiration to fix this issue: https://github.com/rasterio/rasterio/pull/61/files

AsgerPetersen avatar Jun 13 '22 14:06 AsgerPetersen

Happened to me. It return a negative value.

AchmadFathoni avatar Jun 01 '23 14:06 AchmadFathoni

I think I'm encountering this issue with a GeoTIFF that is interpreted incorrectly in OpenLayers. (Referenced above) Is there an update on this bug? Would fixing the getResolution function resolve this?

loganwilliams avatar Nov 03 '23 12:11 loganwilliams