[gdal-dev] Accessing header info from ENVI files

LKeene lkeene at caltech.edu
Mon Jul 19 14:53:25 EDT 2010


Hi folks, I'm trying to use GDAL in a dll we're writing so that we can forgo
using ENVI to open our data files. I'm able to determine the image data
dimensions and acquire access to the data by doing something like the
following:

	// Read file:
	GDALDataset *fileData = (GDALDataset*)GDALOpen(filePath, GA_ReadOnly);

	int RasterX       = fileData->GetRasterXSize();
	int RasterY       = fileData->GetRasterYSize();
	int NumberOfBands = fileData->GetRasterCount();

	// Acquire pointer to the band:
	GDALRasterBand* bandData = fileData->GetRasterBand(1);

        etc...


However, I'm unsure of how to gain access to the various header file
information that's associated with the data file. The header file is
contained in the same folder as the data file and is stored as a simple text
file. Here's an example of one of our header files:


ENVI
description = {
  Distance dx=4.4352 _dx=4.4352 dy=1.1644 _dy=1.1644 Beginning: Mon Jun 21
  16:56:27 2010 End: Mon Jun 21 20:48:16 2010
Time elapsed: 0 day, 3 hours,
  51 minutes, 49 seconds. [Mon Jun 21 20:48:16 2010]}
samples = 8565
lines   = 6973
bands   = 1
header offset = 0
file type = ENVI Standard
data type = 4
interleave = bsq
sensor type = Unknown
byte order = 0
map info = {UTM, 1.000, 1.000, 425030.000, 4059250.000, 1.0000000000e+001,
1.0000000000e+001, 43, North, WGS-84, units=Meters}
wavelength units = Unknown


GDAL must be reading and parsing this header in order to correctly open the
data file, so the various pieces of information should be encapsulated and
available somewhere in the GDAL class library, no? Anyone know how to get at
it? Thanks in advance
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Accessing-header-info-from-ENVI-files-tp5313493p5313493.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list