Joaquim, I believe what you see is the expected behaviour.
You must keep in mind that there are 2 notions : 1) nodata value --> setting it is no more than just setting a "tag" on the raster band. It doesn't change the pixel values by itself as Chaintanya explained 2) initialization of the pixel data of the target image with a given value When you use the -dstnodata option, gdalwarp will automagically do both : 1) Set the target nodata value 2) Initialize the target image with that nodata value (remind of removing the target file if it already exists) If you specify nothing, then 0 is used to fill the target image but the nodata tag is not set. The initialization of the pixel data of the target image is in fact done through the INIT_DEST warping option. See http://gdal.org/structGDALWarpOptions.html#0ed77f9917bb96c7a9aabd73d4d06e08 For example, gdalwarp src.tif dst.tif -wo "INIT_DEST=255" If you specify no INIT_DEST warping option, then gdalwarp uses the dstnodata value if it's specified with -dstnodata and set it as the INIT_DEST value too. I've also tested -dstnodata nan and to my great surprise, it actually works ! However I'm not sure if all applications can deal with the "nan" string put in the 42113 tag used by GDAL for the Nodata value in TIFF. So maybe I've not understood what your problem is, but everything seems to work as expected on my side. Best regards, Even Le Wednesday 12 May 2010 01:37:07 Joaquim Luis, vous avez écrit : > Hi, > > Before filling a ticket I would like to ask here if this gdalwarp > behavior is the intended one. > When I convert a grid from geogs to UTM the nodatavalues are filled with > zeros. > I get the expected behaviour if I use the -dstnodata with a numeric > value, but I found no way tom tell it use NaN. > > Summary > > This puts zeros on the nodata zone, but I don't find it correct as "0" > is not exactly a natural nodata value. For my habits NaN is the natural > no data value. > > gdalwarp -s_srs "+proj=latlong" -t_srs "+proj=utm +zone=29 +datum=WGS84" > swath_grid.grd lixo_utm.tiff > > Furthermore when I load the " lixo_utm.tiff" in Mirone is does not > recognize a nodata value, whilst if I do this instead > > gdalwarp -s_srs "+proj=latlong" -t_srs "+proj=utm +zone=29 +datum=WGS84" > -dstnodata 1 swath_grid.grd lixo_utm.tiff > > than "1" is recognized as the nodata. I have not investigated the > metadata to see why the "0" is not set to represent the nodata. > > Thanks > > Joaquim Luis > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
