[gdal-dev] NITF BlockA and image corners?
Visser, John B.
JohnB.Visser at ga-asi.com
Thu May 8 20:48:04 EDT 2008
I have a NITF with the following corners in the block A:
FRLC_LOC +31.317567-092.535419
LRLC_LOC +31.318452-092.534442
LRFC_LOC +31.317431-092.533187
FRFC_LOC +31.316546-092.534164
But GDAL is reporting the following:
Upper Left ( -92.5341640, 31.3165451)
Lower Left ( -92.5331860, 31.3174311)
Upper Right ( 267.465, 31.318)
Lower Right ( 267.466, 31.318)
Center ( 87.4656970, 31.3174990)
The corners seem "wrapped" as you can tell. Is this normal? Am I
writing the corners to BLOCKA in the wrong order?
The code I'm using is as follows, it was taken primarily from the GDAL
tutorial.
fileInfo->width = GDALGetRasterXSize( hDataset );
fileInfo->height = GDALGetRasterYSize( hDataset );
char** md = GDALGetMetadata(hDataset, NULL);
//adfGeoTransform[0] top left x
//adfGeoTransform[1] w-e pixel resolution
//adfGeoTransform[2] rotation, 0 if image is "north up"
//adfGeoTransform[3] top left y
//adfGeoTransform[4] rotation, 0 if image is "north up"
//adfGeoTransform[5] n-s pixel resolution
if( GDALGetGeoTransform( hDataset, adfGeoTransform ) == CE_None )
{
fileInfo->origin[0] = adfGeoTransform[0];
fileInfo->origin[1] = adfGeoTransform[3];
fileInfo->pixelSize[0] = adfGeoTransform[1];
fileInfo->pixelSize[1] = adfGeoTransform[5];
fileInfo->rotation[0] = adfGeoTransform[2];
fileInfo->rotation[1] = adfGeoTransform[4];
fileInfo->vertices[0].tu = 0.0f;
fileInfo->vertices[0].tv = 0.0f;
fileInfo->vertices[0].x = (double)adfGeoTransform[0];
fileInfo->vertices[0].y = (double)adfGeoTransform[3];
fileInfo->vertices[0].z = 0.0f;
fileInfo->vertices[1].tu = 1.0f;
fileInfo->vertices[1].tv = 0.0f;
fileInfo->vertices[1].x =
(double)(adfGeoTransform[0]+adfGeoTransform[1]*(fileInfo->width));
fileInfo->vertices[1].y = (double)adfGeoTransform[3];
fileInfo->vertices[1].z = 0.0f;
fileInfo->vertices[2].tu = 1.0f;
fileInfo->vertices[2].tv = 1.0f;
fileInfo->vertices[2].x =
(double)(adfGeoTransform[0]+adfGeoTransform[1]*(fileInfo->width));
fileInfo->vertices[2].y =
(double)(adfGeoTransform[3]+adfGeoTransform[5]*(fileInfo->height));
fileInfo->vertices[2].z = 0.0f;
fileInfo->vertices[3].tu = 0.0f;
fileInfo->vertices[3].tv = 1.0f;
fileInfo->vertices[3].x = (double)adfGeoTransform[0];
fileInfo->vertices[3].y =
(double)(adfGeoTransform[3]+adfGeoTransform[5]*(fileInfo->height));
fileInfo->vertices[3].z = 0.0f;
}
More information about the gdal-dev
mailing list