Opened 13 years ago

Closed 12 years ago

#1794 closed defect (fixed)

AAIGRID - error calculating yllcorner in ascii header

Reported by: jdemone Owned by: Mateusz Łoskot
Priority: normal Milestone: 1.4.5
Component: GDAL_Raster Version: 1.4.1
Severity: normal Keywords: AAIGRID, yllcorner
Cc: Mateusz Łoskot


There is an error in the creation of the header in the AAIGRID format. 'yllcorner' is calculated using the dx instead of the dy. A proposed patch is attached.

Attachments (1)

aaigriddataset.cpp.patch (887 bytes) - added by jdemone 13 years ago.
proposed patch

Download all attachments as: .zip

Change History (7)

Changed 13 years ago by jdemone

Attachment: aaigriddataset.cpp.patch added

proposed patch

comment:1 Changed 13 years ago by warmerdam

Cc: warmerdam added
Component: defaultGDAL_Raster
Milestone: 1.4.3
Owner: changed from warmerdam to Mateusz Łoskot
Priority: lownormal
Severity: trivialnormal


Could you look into this? I have a vague recollection that this may have been fixed since 1.4.1.

comment:2 Changed 13 years ago by Mateusz Łoskot

Status: newassigned

As I see, only half of the fix (line 816 in r10146) have been applied since 1.4.1.

comment:3 Changed 13 years ago by Mateusz Łoskot

Resolution: fixed
Status: assignedclosed

I've applied the second part of the fix (r12453).

Frank, Do we have any aaigrid datasets with features specific to Golden Surfer, that we could add to the autotest?

comment:4 Changed 13 years ago by Mateusz Łoskot

I ported the fix to stable branch 1.4 (r12461)

comment:5 Changed 12 years ago by warmerdam

Resolution: fixed
Status: closedreopened

The applied patch is incorrect. It computes YLLCORNER improperly. In normal cases adfGeoTransform[5] is negative while adfGeoTransform[1] was positive. This basically means that yllcorner is written as being as far above the top left corner as it ought to be below the top left corner.

        sprintf( szHeader, 
                 "ncols        %d\n" 
                 "nrows        %d\n"
                 "xllcorner    %.12f\n"
                 "yllcorner    %.12f\n"
                 "dx           %.12f\n"
                 "dy           %.12f\n", 
                 nXSize, nYSize, 
                 adfGeoTransform[3] - nYSize * adfGeoTransform[5],
                 fabs(adfGeoTransform[5]) );

comment:6 Changed 12 years ago by warmerdam

Cc: Mateusz Łoskot added; warmerdam removed
Resolution: fixed
Status: reopenedclosed

Fixed in trunk (r13561), 1.5 (r13562) and 1.4 (r13563).

Added test in test suite (r13564).

Note: See TracTickets for help on using tickets.