Opened 8 years ago

Closed 4 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:
Cc:

Description

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 Changed 8 years ago by Even Rouault

This is a duplicate of #2612

comment:2 Changed 4 years ago by Even Rouault

Resolution: duplicate
Status: newclosed

Closing as duplicate of #5075

Note: See TracTickets for help on using tickets.