Skip to content

Commit 0a4704f

Browse files
Merge pull request #413 from mike-000/rotated-resolution
Calculate resolution correctly for rotated rasters
2 parents 7bccb30 + 9650761 commit 0a4704f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/geotiffimage.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,20 @@ class GeoTIFFImage {
860860
];
861861
}
862862
if (modelTransformation) {
863+
if (modelTransformation[1] === 0 && modelTransformation[4] === 0) {
864+
return [
865+
modelTransformation[0],
866+
-modelTransformation[5],
867+
modelTransformation[10],
868+
];
869+
}
863870
return [
864-
modelTransformation[0],
865-
-modelTransformation[5],
866-
modelTransformation[10],
867-
];
871+
Math.sqrt((modelTransformation[0] * modelTransformation[0])
872+
+ (modelTransformation[4] * modelTransformation[4])),
873+
-Math.sqrt((modelTransformation[1] * modelTransformation[1])
874+
+ (modelTransformation[5] * modelTransformation[5])),
875+
modelTransformation[10]];
876+
}
868877
}
869878

870879
if (referenceImage) {

0 commit comments

Comments
 (0)