[gdal-dev] Setting "INIT_DEST" to nan on windows

Kyle Shannon ksshannon at gmail.com
Mon May 9 17:30:05 EDT 2011


Thanks Even,
If that is the case, are there other values in psWarpOptions I *have* to
set?  I can't find docs discussing that.

kss

/**
 *
 * Kyle Shannon
 * ksshannon at gmail.com
 *
 */




On Thu, May 5, 2011 at 12:21, Even Rouault <even.rouault at mines-paris.org>wrote:

> Le mercredi 04 mai 2011 00:40:42, Kyle Shannon a écrit :
> > I am using AutoCreateWarpedVRT to warp a dataset.  I grab the the source
> > nodata for a band using
> >
> > double noData = poBand->GetNoDataValue( &pbSuccess );
> >
> > which returns 1.#QNAN00000000... on windows.
> >
> > I then try to set the INIT_DEST with this using
> >
> > psWarpOptions->papszWarpOptions =
> >         CSLSetNameValue( psWarpOptions->papszWarpOptions,
> >                  "INIT_DEST", CPLSPrintf( "%lf", noData ) );
> >
> > This works on linux when it returns nan(0x8000000000000), but not on
> > windows, is there a different string I need to set in the warp options?
>
> Those NaN values are generally a nighmare to deal with...
>
> But a quick look at :
>
>    const char *pszInitDest = CSLFetchNameValue(
> psOptions->papszWarpOptions,
>                                                 "INIT_DEST" );
>
>    if( pszInitDest != NULL && !EQUAL(pszInitDest, "") )
>    {
>        char **papszInitValues =
>            CSLTokenizeStringComplex( pszInitDest, ",", FALSE, FALSE );
>        int nInitCount = CSLCount(papszInitValues);
>
>        for( iBand = 0; iBand < psOptions->nBandCount; iBand++ )
>        {
>            double adfInitRealImag[2];
>            GByte *pBandData;
>            const char *pszBandInit =
> papszInitValues[MIN(iBand,nInitCount-1)];
>
>            if( EQUAL(pszBandInit,"NO_DATA")
>                && psOptions->padfDstNoDataReal != NULL )
>            {
>                adfInitRealImag[0] = psOptions->padfDstNoDataReal[iBand];
>                adfInitRealImag[1] = psOptions->padfDstNoDataImag[iBand];
>            }
>            else
>            {
>                CPLStringToComplex( pszBandInit,
>                                    adfInitRealImag + 0, adfInitRealImag +
> 1);
>            }
>
> Make me believe that one way is to assign the value(s) of the
> padfDstNoDataReal[] array of psWarpOptions with the noData (NAN) value and
> set
> INIT_DEST to the "NO_DATA" string.
>
> >
> > Thanks.
> >
> >
> > /**
> >  *
> >  * Kyle Shannon
> >  * ksshannon at gmail.com
> >  *
> >  */
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110509/3bd19f12/attachment.html


More information about the gdal-dev mailing list