[Gdal-dev] Problem in Ehdr (ESRI .hdr) reader

Frank Warmerdam warmerdam at pobox.com
Mon Aug 9 10:15:46 EDT 2004

Thom DeCarlo wrote:
> I was trying to process some SRTM1 data that I got from USGS. These files
> already had the .hdr, .prj, and other header files so I didn't use Markus'
> script to generate the header files. 
> What I found was that gdal does not recognize the UNITS field in the .prj
> file and therefore incorrectly interprets the ULXMAP, ULYMAP, XDIM, and YDIM
> values in the .hdr file. (Converting the files using Erdas produced
> similarly bad results.) 
> I'm not sure if this covers all the allowed values, but it seems that gdal
> should interpret at least these:
> UNITS <DD | DM | DS> 
> Where DD = decimal degrees, DM = decimal minutes, and DS = decimal seconds.
> (DS is the important one for me.)
> I've attached the header files for one of the datasets, but the actual data
> is too big to email.
> I've tried looking around at the code, but I can't immediately see where all
> the needed changes would occur to support this new field. Of course, I could
> simply be misusing the gdal translator. If so, can you tell me how to read
> these?


I took a quick peek at this.  The solution would appear to be for the code
for reading ESRI .prj files i gdal/ogr/ogr_srs_esri.cpp to read the units and
insert the appropriate definition for geographic coordinate systems.  However,
this will do little good for now since none of GDAL/OGR supports units other
than decimal degrees for geographic coordinates at this time.   This would be
rather a large problem to solve.

The more pragmatic workaround would be to have the ESRI .HDR driver adjust
the coordinates appropriately if they are DS or DM; however, that is a messy
and incomplete solution so I am hesitant to spend a bunch of time on it just

I have stashed your .prj file and headers in my sample tree but I don't
anticipate working on the issue in the near future.  You will need to devide
the coordinate values in the .hdr file by 3600 manually.

Sorry about that, and thanks for the report.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the Gdal-dev mailing list