Opened 16 years ago
Closed 7 years ago
#2440 closed defect (fixed)
ENVI dataset geotransform
Reported by: | rsoconnor | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | ENVI |
Cc: | antonio |
Description
There is a possible bug in file "envidataset.cpp" in line 567.
In the function WriteProjectionInfo
osLocation.Printf( "1, 1, %.15g, %.15g, %.15g, %.15g", adfGeoTransform[0], adfGeoTransform[3], adfGeoTransform[1], fabs(adfGeoTransform[5]) );
The last argument is hardcoded to be always positive. This will result in an incorrect transform if the true value is negative when the file is read back in.
I believe it should be:
osLocation.Printf( "1, 1, %.15g, %.15g, %.15g, %.15g", adfGeoTransform[0], adfGeoTransform[3], adfGeoTransform[1], -adfGeoTransform[5] );
Attachments (2)
Change History (7)
comment:1 by , 11 years ago
Cc: | added |
---|
by , 11 years ago
Attachment: | envi_geotransform_bug.py added |
---|
by , 11 years ago
Attachment: | envi_geotransform_bug.patch added |
---|
comment:2 by , 11 years ago
Please find attached a small test program to reproduce the issue and a patch implementing the solution suggested by rsoconnor (including a regression test).
Anyway I'm not sure that the proposed solution is OK since elements 6 and 7 of the "map info" parameter (see http://www.exelisvis.com/docs/ENVIRasterMetaData.html) should be x and y pixel sizes and I doubt they can have negative values.
The attached patch fixes the issue in GDAL but I don't know if it produces files that actually compatible with IDL/ENVI.
comment:3 by , 9 years ago
The fix feels safe from the GDAL point of view because in vast majority of cases the value of Y coordinate is decreasing from top to down and the result would be just the same. In optimal case we would have a real sample file created by ENVI and showing the Y value increasing from top to down. By reading the documentation about ENVI header file structure it is impossible to know how the "map info" field of such image would look like.
comment:4 by , 9 years ago
Priority: | high → normal |
---|
All those tickets have more than one year and nobody has acted on it, so the priority is not so high
comment:5 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Probably obsoleted by the fix done in #1778
Small test program to reproduce the issue