Opened 6 years ago

Closed 6 years ago

#7114 closed defect (fixed)

ENVI driver does not support "major frame offsets" and "minor frame offsets"

Reported by: liminlu0314 Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: ENVI major_frame_offsets minor_frame_offsets
Cc:

Description

The file "p1bg06931.N18.1b" can be displayed normally using ENVI, but cannot be displayed correctly in QGIS.

The following code can solve this problem, which has been added in the file  ​https://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/raw/envidataset.cpp#L2330

	const char* pszMajorFrameOffset = NULL;
	pszMajorFrameOffset = CSLFetchNameValue(poDS->papszHeader, "major_frame_offsets");
	if (pszMajorFrameOffset != NULL)
	{
		char **papszMajorFrameOffsets = poDS->SplitList(pszMajorFrameOffset);

		CPLString tempString;
		int nTempCount = CSLCount(papszMajorFrameOffsets);
		if (papszMajorFrameOffsets && nTempCount == 2)
		{
			tempString = papszMajorFrameOffsets[0];
			int nOffset1 = atoi(tempString.c_str());
			tempString = papszMajorFrameOffsets[1];
			int nOffset2 = atoi(tempString.c_str());

			nHeaderSize += nOffset1;
			nLineOffset += nOffset1 + nOffset2;
		}
	}

Test data link: https://www.dropbox.com/s/qupzg8bkwlwxohz/NOAA18.zip?dl=0

Change History (1)

comment:1 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 40595:

ENVI: support 'major frame offsets' keyword (derived from patch by liminlu0314, fixes #7114)

Note: See TracTickets for help on using tickets.