[Gdal-dev] GDALWarpOptions padfSrcNoDataImag

Craig Miller craig.miller at spatialminds.com
Mon May 7 11:03:39 EDT 2007


It turned out that one image out of several hundred in a collection didn't
have the projection defined.  I added a -s_srs option to my utility and
everything works smoothly again.

I didn't actually log the bug as another one popped up in a different spot
(in my utilities code) so I couldn't verify if the change fixes the problem
or just compiles ok.  I'd be happy to log it though.

Thanks for the helpful reply.

Craig
 

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: Wednesday, May 02, 2007 3:21 PM
To: Craig Miller
Cc: Gdal-Dev
Subject: Re: [Gdal-dev] GDALWarpOptions padfSrcNoDataImag

Craig Miller wrote:
> 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?

Craig,

I don't know why this would only affect one image out of many similar ones.
But I do think this code in Initialize() should not assume padfSrcNoDataImag
is non-NULL just because padfSrcNoDataReal is non-NULL

             if( hSrcBand != NULL
                 && psOptions->padfSrcNoDataReal != NULL )
             {
                 int bMergeSource = FALSE;

                 if( psOptions->padfSrcNoDataImag[iBand] != 0.0
                     && !GDALDataTypeIsComplex( psOptions->eWorkingDataType
) )
                     bMergeSource = TRUE;

Could you file a bug on this, and I'll fix it in trunk and 1.4 branch.  I
think the fix would be to change:

                 if( psOptions->padfSrcNoDataImag[iBand] != 0.0
                     && !GDALDataTypeIsComplex( psOptions->eWorkingDataType
) )
                     bMergeSource = TRUE;

to:
                 if( psOptions->padfSrcNoDataImag != NULL
                     && psOptions->padfSrcNoDataImag[iBand] != 0.0
                     && !GDALDataTypeIsComplex( psOptions->eWorkingDataType
) )
                     bMergeSource = TRUE;

Best regards,
-- 
---------------------------------------+--------------------------------
---------------------------------------+------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list