Opened 15 years ago

Closed 11 years ago

#3056 closed defect (duplicate)

ERMapper .ers driver not handling registration cells correctly

Reported by: dougc Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords:


Starting at line 891 of rev 17119 of ersdataset.cpp, the handling of registration cells is incorrect. I believe the default should be 0,0 and there should not be a 1 subtracted in the transformation. With the existing code, a registration cell that's present but with x and/or y set to 0 results in a -1 offset being applied when there should be no offset. Also, the -1 offset causes an off by one error in all other cases. Suggested replacement:

/* -------------------------------------------------------------------- */
/*      Adjust if we have a registration cell.                          */
/* -------------------------------------------------------------------- */
    int iCellX = atoi(poHeader->Find("RasterInfo.RegistrationCellX", "0"));
    int iCellY = atoi(poHeader->Find("RasterInfo.RegistrationCellY", "0"));

    if( poDS->bGotTransform )
        poDS->adfGeoTransform[0] -=
            iCellX * poDS->adfGeoTransform[1]
            + iCellY * poDS->adfGeoTransform[2];
        poDS->adfGeoTransform[3] -= 
            iCellX * poDS->adfGeoTransform[4]
            + iCellY * poDS->adfGeoTransform[5];

Change History (2)

comment:1 by Even Rouault, 15 years ago

This is a duplicate of #2612

comment:2 by Even Rouault, 11 years ago

Resolution: duplicate
Status: newclosed

Closing as duplicate of #5075

Note: See TracTickets for help on using tickets.