Opened 10 years ago

Closed 10 years ago

#5553 closed defect (fixed)

GDAL RPC Transformer Error when use dem

Reported by: liminlu0314 Owned by: warmerdam
Priority: normal Milestone: 1.11.1
Component: Algorithms Version: 1.11.0
Severity: normal Keywords: RPC DEM interpolation
Cc:

Description

When correcting images with RPC, if the specified DEM interpolation algorithm is ‘near’, the transformed result will be wrong. The reason is that when interpolates DEM with ‘near’, the storage type of elevation values that RasterIO function read is inconsistent with specified type, the former is a double while the latter a GDT_Int32, thus leads to this error. The patch is to change the GDT_Int32 to GDT_Float64, which can modify this bug. in line 778 and 913 of file gdal_rpc.cpp.

old code

                else
                {
                    if (!(dX >= 0 && dY >= 0 && dX <= nRasterXSize && dY <= nRasterYSize))
                    {
                        panSuccess[i] = FALSE;
                        continue;
                    }
                    CPLErr eErr = psTransform->poDS->RasterIO(GF_Read, dX, dY, 1, 1,
                                                              &dfDEMH, 1, 1,
                                                              GDT_Int32, 1, bands, 0, 0, 0);
                    if(eErr != CE_None)
                    {
                        panSuccess[i] = FALSE;
                        continue;
                    }              
                }                

new code

                else
                {
                    if (!(dX >= 0 && dY >= 0 && dX <= nRasterXSize && dY <= nRasterYSize))
                    {
                        panSuccess[i] = FALSE;
                        continue;
                    }
                    CPLErr eErr = psTransform->poDS->RasterIO(GF_Read, dX, dY, 1, 1,
                                                              &dfDEMH, 1, 1,
                                                              GDT_Float64, 1, bands, 0, 0, 0);
                    if(eErr != CE_None)
                    {
                        panSuccess[i] = FALSE;
                        continue;
                    }              
                }                

Change History (1)

comment:1 by Even Rouault, 10 years ago

Resolution: fixed
Status: newclosed

Thanks a lot !

trunk r27485, branches/1.11 r27486 "RPC transformer with DEM: fix near interpolation (patch by liminlu0314, #5553)"

Note: See TracTickets for help on using tickets.