Ticket #1730 (closed defect: fixed)

Opened 1 year ago

Last modified 7 months ago

GDAL returns incorrect unit type from ENVI header

Reported by: rbanfield Assigned to: warmerdam
Priority: normal Milestone: 1.5.1
Component: GDAL_Raster Version: 1.4.2
Severity: normal Keywords: ENVI Units Meter
Cc:

Description

GDAL is not grabbing the correct units from an ENVI header file. I am not sure if it is limited to this data format alone.

I am attaching 2 files, a sample header file, and the corresponding output from gdalinfo.

Attachments

km.hdr (1.9 kB) - added by rbanfield on 07/31/07 17:44:48.
ENVI Header file
gdalinfo.txt (3.6 kB) - added by rbanfield on 07/31/07 17:45:33.
Output from GDALInfo

Change History

07/31/07 17:44:48 changed by rbanfield

  • attachment km.hdr added.

ENVI Header file

07/31/07 17:45:33 changed by rbanfield

  • attachment gdalinfo.txt added.

Output from GDALInfo

08/01/07 09:34:28 changed by warmerdam

The ENVI coordinate system handling was largely rewritten since 1.4.x and should be much more robust. Would you be able to try a nightly source snapshot from subversion or perhaps the latest FWTools binaries and see if they work reasonably?

08/01/07 09:39:34 changed by warmerdam

  • status changed from new to assigned.
  • component changed from default to GDAL_Raster.
  • milestone set to 1.5.0.

I see the units are Km in the file, but this isn't handled by the driver in trunk either. So no need to check yourself.

I'll aim to resolve this by 1.5.0 release. I have some docs from the ENVI folks which will hopefully have a list of units.

10/04/07 14:02:23 changed by warmerdam

I have committed a major update from Bruce Payne (ITTVIS) which includes better linear units support. However, it still produces wrong results for the indicated file because SetUTM() sets the false easting and north in meters, but the linear units of km on the coordinate system cause these offsets to be treated as kilometers.

This can be worked around by using SetLinearUnitsAndUpdateParameters?() instead of SetLinearUnits?(), but it is not clear if this is appropriate. It will be appropriate if false easting and north values from the .hdr file are always in meters regardless of the linear units. Otherwise we may need to special case UTM.

Waiting for feedback frm Bruce.

10/04/07 15:10:04 changed by warmerdam

Bruce Payne wrote:
> Frank,
>    After a little more research into this, any projection parameters for
> custom (and standard) projections are always in meters.   There are
> quite a few projection types that use false easting and false northing,
> but I don't see a lot of other linear parameters in our projection
> definitions.  Generally these are angular, which will always be in
> degrees.  So I think that the change you are proposing should be not
> only safe, but required.  
> 
> To sum up: the tie points and pixel sizes are stored in the specified
> linear units, but those units do not apply to parameters used to specify
> the projection.

Applied change as r12323 in trunk.

02/19/08 09:56:15 changed by warmerdam

  • status changed from assigned to closed.
  • resolution set to fixed.

To the best of my knowledge r12323 fixed this issue. Let me know if anyone knows otherwise.