Opened 17 years ago

Closed 16 years ago

#1730 closed defect (fixed)

GDAL returns incorrect unit type from ENVI header

Reported by: rbanfield Owned by: 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 (2)

km.hdr (1.9 KB ) - added by rbanfield 17 years ago.
ENVI Header file
gdalinfo.txt (3.6 KB ) - added by rbanfield 17 years ago.
Output from GDALInfo

Download all attachments as: .zip

Change History (7)

by rbanfield, 17 years ago

Attachment: km.hdr added

ENVI Header file

by rbanfield, 17 years ago

Attachment: gdalinfo.txt added

Output from GDALInfo

comment:1 by warmerdam, 17 years ago

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?

comment:2 by warmerdam, 17 years ago

Component: defaultGDAL_Raster
Milestone: 1.5.0
Status: newassigned

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.

comment:3 by warmerdam, 17 years ago

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.

comment:4 by warmerdam, 17 years ago

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.

comment:5 by warmerdam, 16 years ago

Resolution: fixed
Status: assignedclosed

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

Note: See TracTickets for help on using tickets.