[Gdal-dev] Re: Coordinate to pixel space?
Mauricio de Paulo
mauricio at open3dgis.org
Fri Aug 24 15:42:29 EDT 2007
Gdal gives an affine transformation of a dataset.
//C++ gdal code to get affine transformation:
double *padfTransform = new double[6];
GDALDataset poDataset;
poDataset.Open("cbers.tif");
poDataset.GetGeoTransform (padfTransform)
//Transforming to projection coordinates from pixel coordinates:
Xp = padfTransform[0] + P*padfTransform[1] + L*padfTransform[2];
Yp = padfTransform[3] + P*padfTransform[4] + L*padfTransform[5];
The parameters must be set in a double[6]
I once used the inverse affine in a program. I can get you the code but
the transformation need some recalculations and the equation is a little
too big for me to remember at the moment.
I hope i could help
Maurício de Paulo
Cartography Engineer (In a few months :D).
More information about the Gdal-dev
mailing list