[gdal-dev] gdalwarp's default nodata value

Joaquim Luis jluis at ualg.pt
Wed May 12 18:29:52 EDT 2010


>> papszWarpOptions = CSLSetNameValue(papszWarpOptions, "INIT_DEST", "nan" );
>>
>> than I get zeros again in place of the nodata.
>>      
> Works for me. You'll have to use your debugger I'm afraid
>    

For the rec, VS2010 and a quite recent trunk version.

>> papszWarpOptions = CSLSetNameValue(papszWarpOptions, "INIT_DEST", "NO_DATA"
>> ); ...
>> 	psWO->padfSrcNoDataReal = (double *)
>> CPLMalloc(psWO->nBandCount*sizeof(double)); psWO->padfSrcNoDataImag =
>> (double *) CPLMalloc(psWO->nBandCount*sizeof(double)); for (i = 0; i<
>> nBands; i++) {
>> 		psWO->padfSrcNoDataReal[i] = 500.;
>> 		psWO->padfSrcNoDataImag[i] = 0.0;
>> 		GDALSetRasterNoDataValue( GDALGetRasterBand(hDstDS, i+1),
>> pdfDstNodata[0]); }
>>      
> Hum, do you realize that you set padfSrcNoDataReal ? INIT_DEST=NO_DATA will
> fetch from padfDstNoDataReal as stated in the above doc...
>    


Ghrrrrrrrrrr, blind copy-paste is-what-it-was

THANKS

psWO->padfDstNoDataReal[i] = mxGetNaN();        // ( mxGetNaN() --> a 
Matlab API function)

Works fine now.


Joaquim


> Read the error message again ;-) "does not support direct output file
> creation"-->  netCDF driver indeed only supports CreateCopy(), not Create()
> (-->  random access) which is required by gdalwarp.
>
> The drivers that are supported as output driver for gdalwarp will have a '+'
> in the output of gdalinfo --formats. Look at the difference betwenn GeoTIFF
> and netCDF:
>
>     GTiff (rw+v): GeoTIFF
>     netCDF (rw): Network Common Data Format
>    



More information about the gdal-dev mailing list