[Gdal-dev] setting nodata for gdalwarp result

Frank Warmerdam warmerdam at pobox.com
Wed Feb 14 19:20:51 EST 2007


Dylan Beaudette wrote:
> Greetings,
> 
> I am warping many images, and would like to set the destination nodata to a 
> value which will allow me to mask out the projection artifacts (collar) when 
> displaying these images with Mapserver. The source data are DOQQ (black and 
> white) in a variety of UTM coordinate systems. In projecting them to AEA, a 
> large 'collar' is introduced in the areas where the image was rotated. Up 
> until now I have told Mapserver to ignore black pixels, but this has the 
> obvious side-effect of throwing out *real* black pixels.
> 
> I am using the -dstnodata -9999 to set the new nodata pixels to something 
> other than black (0) ... but this does not seem to work.
> 
> Any thoughts on how to do this would be greatly appreciated.

Dylan,

One approach would be to prescale your data to the range 1-255 instead of
0 to 255.  That way when you use 0 as a nodata value it would not conflict
with any real data.

If you want to use a value like -9999 then you would have to produce 16bit
files rather than 8bit files.  The extra processing time (in mapserver) and
other complications of 16bit data make this seem like an unattractive option
from my point of view.

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