[Gdal-dev] GDALWarpOptions padfSrcNoDataImag

Craig Miller craig.miller at spatialminds.com
Wed May 2 15:03:13 EDT 2007


I'm getting an exception in GDALWarpOperation when I initialize with my warp
options.  The exception is getting thrown when Initialize verifies that
padfSrcNoDataImag[0] isn't 0 since padfSrcNoDataImag is NULL.  I can of
course tweak gdal to check for a NULL pointer instead of looking for 0 in
the 0 index, but without digging further I'm not 100% that is ok.  I've
processed several hundred files with my code the way it is, and it is only
this new image that is giving me fits so I thought I'd first try and
determine what the padfSrcNoDataImag option is.  With a cursory look at the
docs I haven't been able to find a description of how/why this gets set.
Any suggestions?

Code snippet follows sig.

Thanks,
Craig

Craig Miller
www.spatialminds.com 

// Setup warp options. 
GDALWarpOptions *psWarpOptions = GDALCreateWarpOptions();

psWarpOptions->hSrcDS = m_poUtmRgbDataset;
psWarpOptions->hDstDS = m_poGeoRgbDataset;

psWarpOptions->nBandCount = 3;
psWarpOptions->panSrcBands = (int *) CPLMalloc(sizeof(int) *
psWarpOptions->nBandCount );
psWarpOptions->panSrcBands[0] = 1;
psWarpOptions->panSrcBands[1] = 2;
psWarpOptions->panSrcBands[2] = 3;
psWarpOptions->panDstBands = (int *) CPLMalloc(sizeof(int) *
psWarpOptions->nBandCount );
psWarpOptions->panDstBands[0] = 1;
psWarpOptions->panDstBands[1] = 2;
psWarpOptions->panDstBands[2] = 3;
psWarpOptions->padfSrcNoDataReal = &NO_DATA;
psWarpOptions->padfDstNoDataReal = &NO_DATA;
psWarpOptions->papszWarpOptions = papszWarpOptions;
psWarpOptions->eResampleAlg = GRA_CubicSpline;
psWarpOptions->pfnProgress = GDALTermProgress;   

// Establish reprojection transformer. 
psWarpOptions->pTransformerArg = GDALCreateGenImgProjTransformer( 
     m_poUtmRgbDataset, 
     GDALGetProjectionRef(m_poUtmRgbDataset),
     m_poGeoRgbDataset,
     GDALGetProjectionRef(m_poGeoRgbDataset), 
     FALSE, 
     0.0, 
     1 );
psWarpOptions->pfnTransformer = GDALGenImgProjTransform;

// Initialize and execute the warp operation. 
GDALWarpOperation oOperation;
oOperation.Initialize( psWarpOptions );




More information about the Gdal-dev mailing list