Opened 16 years ago

Closed 16 years ago

#2348 closed defect (fixed)

Cannot open a USGS DEM file?

Reported by: dmalav Owned by: warmerdam
Priority: high Milestone: 1.5.2
Component: GDAL_Raster Version: 1.5.1
Severity: blocker Keywords: usgsdem
Cc:

Description

Hi,

I could not open this USGS DEM file using GDAL. I checked the file with other dem viewing programs and it looks fine there.

I am using the following code.

GDALAllRegister();

poDataset = (GDALDataset *) GDALOpen( DemFile, GA_ReadOnly ); if( poDataset == NULL ) {

acad_printf("Error opening file %s\n%s\n",DemFile, CPLGetLastErrorMsg()); CPLFreeConfig(); return 0;

}

It comes with an error "not recognised as a supported file format."

File is attached, if you do not see the file please let me know. Any help would be greatly appreciated. Thanks, Dinesh

Attachments (1)

39079G6.zip (231.0 KB ) - added by dmalav 16 years ago.
USGS DEM File

Download all attachments as: .zip

Change History (2)

by dmalav, 16 years ago

Attachment: 39079G6.zip added

USGS DEM File

comment:1 by warmerdam, 16 years ago

Keywords: usgsdem added
Resolution: fixed
Status: newclosed

I have come to the conclusion that the file is non-standard in at least a couple ways.

  • At byte 150 it uses code " 4" for the "code defining elevation pattern" field instead of the usual " 1".
  • The first B record has a column number of 0 instead of 1.

I reviewed the latest version of the sdts2dem program used to generate the file, and I don't see how it could have produced the indicated elevation pattern value. So that's sort of weird. Perhaps because it was generated with an older version?

In any event, I have modified usgsdemdataset.cpp to ignore these two quirks and then reading seems to work fine. Changes are in trunk (r14380) and 1.5 (r14381).

Note: See TracTickets for help on using tickets.