GDAL GetGeoTransform Documentation — Is there an oversight, or what am I misunderstanding?
The documentation for GDALDataset::GetGeoTransform says some things that are rather confusing.
Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space.
Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];
In a north up image,
padfTransform[1]
is the pixel width, andpadfTransform[5]
is the pixel height.
The upper left corner of the upper left pixel is at position (
padfTransform[0]
,padfTransform[3]
).
The default transform is
(0,1,0,0,0,1)
and should be returned even when a CE_Failure error is returned, such as for formats that don't support transformation to projection coordinates.
If this is a matrix, it makes sense that Pixel_X is at 1,1 and Pixel_Y is at 2,2.
Here is my question:
So should the equation for Yp be:
Yp = padfTransform[3] + L*padfTransform[4] + P*padfTransform[5];
in which the positions of L and P are swapped?
Or if I am confused about something, can someone help me get unconfused?
gdal documentation
add a comment |
The documentation for GDALDataset::GetGeoTransform says some things that are rather confusing.
Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space.
Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];
In a north up image,
padfTransform[1]
is the pixel width, andpadfTransform[5]
is the pixel height.
The upper left corner of the upper left pixel is at position (
padfTransform[0]
,padfTransform[3]
).
The default transform is
(0,1,0,0,0,1)
and should be returned even when a CE_Failure error is returned, such as for formats that don't support transformation to projection coordinates.
If this is a matrix, it makes sense that Pixel_X is at 1,1 and Pixel_Y is at 2,2.
Here is my question:
So should the equation for Yp be:
Yp = padfTransform[3] + L*padfTransform[4] + P*padfTransform[5];
in which the positions of L and P are swapped?
Or if I am confused about something, can someone help me get unconfused?
gdal documentation
add a comment |
The documentation for GDALDataset::GetGeoTransform says some things that are rather confusing.
Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space.
Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];
In a north up image,
padfTransform[1]
is the pixel width, andpadfTransform[5]
is the pixel height.
The upper left corner of the upper left pixel is at position (
padfTransform[0]
,padfTransform[3]
).
The default transform is
(0,1,0,0,0,1)
and should be returned even when a CE_Failure error is returned, such as for formats that don't support transformation to projection coordinates.
If this is a matrix, it makes sense that Pixel_X is at 1,1 and Pixel_Y is at 2,2.
Here is my question:
So should the equation for Yp be:
Yp = padfTransform[3] + L*padfTransform[4] + P*padfTransform[5];
in which the positions of L and P are swapped?
Or if I am confused about something, can someone help me get unconfused?
gdal documentation
The documentation for GDALDataset::GetGeoTransform says some things that are rather confusing.
Fetches the coefficients for transforming between pixel/line (P,L) raster space, and projection coordinates (Xp,Yp) space.
Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];
In a north up image,
padfTransform[1]
is the pixel width, andpadfTransform[5]
is the pixel height.
The upper left corner of the upper left pixel is at position (
padfTransform[0]
,padfTransform[3]
).
The default transform is
(0,1,0,0,0,1)
and should be returned even when a CE_Failure error is returned, such as for formats that don't support transformation to projection coordinates.
If this is a matrix, it makes sense that Pixel_X is at 1,1 and Pixel_Y is at 2,2.
Here is my question:
So should the equation for Yp be:
Yp = padfTransform[3] + L*padfTransform[4] + P*padfTransform[5];
in which the positions of L and P are swapped?
Or if I am confused about something, can someone help me get unconfused?
gdal documentation
gdal documentation
edited 2 hours ago
user2856
30.1k258105
30.1k258105
asked 3 hours ago
philologonphilologon
1205
1205
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
No.
For a north up image with no rotation (i.e. padfTransform[4] == padfTransform[2] == 0
), the formula simply becomes:
Xp = padfTransform[0] + P*padfTransform[1];
Yp = padfTransform[3] + L*padfTransform[5];
# Where P = column number and L = row number
i.e add the starting X (or Y) to the column (or row) number multiplied by the pixel width (or height).
The rotation terms may be what's tripping you up...? When a pixel is rotated, the Y
skew needs to be considered when calculating the X
map coordinate and the X
skew needs to be considered when calculating the Y
map coordinate. There's a quite detailed explanation in the wikipedia article on world files.
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
1
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f314654%2fgdal-getgeotransform-documentation-is-there-an-oversight-or-what-am-i-misund%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No.
For a north up image with no rotation (i.e. padfTransform[4] == padfTransform[2] == 0
), the formula simply becomes:
Xp = padfTransform[0] + P*padfTransform[1];
Yp = padfTransform[3] + L*padfTransform[5];
# Where P = column number and L = row number
i.e add the starting X (or Y) to the column (or row) number multiplied by the pixel width (or height).
The rotation terms may be what's tripping you up...? When a pixel is rotated, the Y
skew needs to be considered when calculating the X
map coordinate and the X
skew needs to be considered when calculating the Y
map coordinate. There's a quite detailed explanation in the wikipedia article on world files.
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
1
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
add a comment |
No.
For a north up image with no rotation (i.e. padfTransform[4] == padfTransform[2] == 0
), the formula simply becomes:
Xp = padfTransform[0] + P*padfTransform[1];
Yp = padfTransform[3] + L*padfTransform[5];
# Where P = column number and L = row number
i.e add the starting X (or Y) to the column (or row) number multiplied by the pixel width (or height).
The rotation terms may be what's tripping you up...? When a pixel is rotated, the Y
skew needs to be considered when calculating the X
map coordinate and the X
skew needs to be considered when calculating the Y
map coordinate. There's a quite detailed explanation in the wikipedia article on world files.
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
1
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
add a comment |
No.
For a north up image with no rotation (i.e. padfTransform[4] == padfTransform[2] == 0
), the formula simply becomes:
Xp = padfTransform[0] + P*padfTransform[1];
Yp = padfTransform[3] + L*padfTransform[5];
# Where P = column number and L = row number
i.e add the starting X (or Y) to the column (or row) number multiplied by the pixel width (or height).
The rotation terms may be what's tripping you up...? When a pixel is rotated, the Y
skew needs to be considered when calculating the X
map coordinate and the X
skew needs to be considered when calculating the Y
map coordinate. There's a quite detailed explanation in the wikipedia article on world files.
No.
For a north up image with no rotation (i.e. padfTransform[4] == padfTransform[2] == 0
), the formula simply becomes:
Xp = padfTransform[0] + P*padfTransform[1];
Yp = padfTransform[3] + L*padfTransform[5];
# Where P = column number and L = row number
i.e add the starting X (or Y) to the column (or row) number multiplied by the pixel width (or height).
The rotation terms may be what's tripping you up...? When a pixel is rotated, the Y
skew needs to be considered when calculating the X
map coordinate and the X
skew needs to be considered when calculating the Y
map coordinate. There's a quite detailed explanation in the wikipedia article on world files.
edited 1 hour ago
answered 2 hours ago
user2856user2856
30.1k258105
30.1k258105
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
1
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
add a comment |
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
1
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
That there is rotation is what was tripping me up. So can you tell me what P and L stand for? I naively supposed that P was Pixel dimension and L was Line dimension (the lines between pixels). Yes, that is as foolish as a sophomore reasoning with senior. In that vein, what do those letters stand for?
– philologon
2 hours ago
1
1
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
@philologon P is column number, and L is row number. These are "coordinates" on the raster image.
– Mike T
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
Thanks. I now see it is right there in the documentation. I always find a way to embarrass myself in these kinds of things, usually by skimming too fast.
– philologon
2 hours ago
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f314654%2fgdal-getgeotransform-documentation-is-there-an-oversight-or-what-am-i-misund%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e) {
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom)) {
StackExchange.using('gps', function() { StackExchange.gps.track('embedded_signup_form.view', { location: 'question_page' }); });
$window.unbind('scroll', onScroll);
}
};
$window.on('scroll', onScroll);
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown