[gdal-dev] Advice on `GDALCreateAndReprojectImage` and destination no-data value.

Even Rouault even.rouault at spatialys.com
Fri Nov 3 16:02:55 PDT 2023


Simeon,
>     Band 1 Block=210x39 Type=Byte, ColorInterp=Gray
>
> The only way I've been able to get the behavior I need is to open the 
> written dataset from the filesystem and set the no-data value 
> explicitly in the band, which is inefficient and awkward.

You don't have much alternative than doing that if you use 
GDALCreateAndReprojectImage(). But GDALCreateAndReprojectImage() is a 
"simplistic" warp API that doesn't have all the bells and whistles of 
what gdalwarp lib. You could potentially submit a patch to 
GDALCreateAndReprojectImage() to set the nodata value, which would be 
reasonable, but perhaps you could just bind the GDALWarp() C function 
that is the heart of the gdalwarp binary. You'd get all the advanced 
heuristics of gdalwarp that you don't get with the less advanced warp 
functions.

Even

-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list