[Geotiff] map info and projections from GeoTIFF file to create ENVI header

Nevzat Guler nguler at spectral.com
Fri Jan 15 10:22:50 EST 2016


Dear experts,

I am reading LANDSAT GeoTIFF files and combining bands to create and ENVI cube.
I am using GDAL to read the GeoTIFF file, and my own custom cube writer to write
the ENVI style cube. Transferring the map information proved to be a bit
convoluted. I seek your help to figure out this. 

My first problem is to access map info from GeoTIFF file. The map info includes:

map info = {UTM, 1.000, 1.000, 145185.000, 2189715.000, 3.0000000000e+001,
3.0000000000e+001, 19, North, WGS-84, units=Meters}

I am able to get the location (x,y), and pixel size (x,y) from :
double adfGeoTransform[6];
srcDS->GetGeoTransform(adfGeoTransform);

But, I could not see any way to get the UTM, pixel tie points, Unit and DATUM in
GDAL. Is there any way to get them?

Finally, for the Coordinate System String, GDAL gives me:

PROJCS["unnamed",PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin
",0],PARAMETER["central_meridian",-69],PARAMETER["scale_factor",0.9996],PARAMETE
R["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]

But I should actually get

PROJCS["UTM_Zone_19N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHO
RITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree
",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECT
ION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_
meridian",-69],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000
],PARAMETER["false_northing",0],UNIT["Meter",1]]

GDAL gives me PROCCS, unnamed. And no GEOGCS information is given.  I am able to
get the coordinate system properties by using the following commands but I first
need to set few things to use exportToWTK.

>>       OGRSpatialReference oSRS;
>>       char *pszWKT = NULL;
>>       oSRS.SetProjCS("UTM_Zone_19N");
>>       oSRS.SetWellKnownGeogCS("WGS84");
>>       oSRS.SetUTM(19, TRUE);
>>       oSRS.SetWellKnownGeogCS("WGS84");
>>       oSRS.exportToWkt(&pszWKT);
>>       printf("%s\n", pszWKT);

But I need to set SetProjCS, SetWellKnownGeogCS and SetUTM first. However, I
don't know these before I read the file. Is there any way to get them from the
file so that I don't need prior knowledge to create the header. When I pull the
GeoTIFF file into ENVI, all these information is already there.

I appreciate your help and suggestions.
Best regards, 
- Nevzat



More information about the Geotiff mailing list