Skip to content

Don't write ModelPixelScale, ModelTiepoint when ModelTransformationTag is present #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/geotiffwriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ export function writeGeotiff(data, metadata) {
metadata.StripByteCounts = [numBands * height * width];
}

if (!metadata.ModelPixelScale) {
if (!metadata.ModelPixelScale && !metadata.ModelTransformation) {
// assumes raster takes up exactly the whole globe
metadata.ModelPixelScale = [360 / width, 180 / height, 0];
}
Expand All @@ -367,7 +367,9 @@ export function writeGeotiff(data, metadata) {
// if didn't pass in projection information, assume the popular 4326 "geographic projection"
if (!metadata.hasOwnProperty('GeographicTypeGeoKey') && !metadata.hasOwnProperty('ProjectedCSTypeGeoKey')) {
metadata.GeographicTypeGeoKey = 4326;
metadata.ModelTiepoint = [0, 0, 0, -180, 90, 0]; // raster fits whole globe
if (!metadata.ModelTransformation) {
metadata.ModelTiepoint = [0, 0, 0, -180, 90, 0]; // raster fits whole globe
}
metadata.GeogCitationGeoKey = 'WGS 84';
metadata.GTModelTypeGeoKey = 2;
}
Expand Down