[gdal-dev] Problem with nodata values

Rainer M Krug r.m.krug at gmail.com
Wed Jul 29 03:08:49 EDT 2009


On Fri, Jul 24, 2009 at 5:44 PM, Frank Warmerdam<warmerdam at pobox.com> wrote:
> Rainer M Krug wrote:
>>
>> Hi
>>
>> I have a geotiff and want to use gdalwarp to warp to it into a
>> different projection.
>> I do the following:
>>
>> gdalwarp -s_srs EPSG:32734 -t_srs '+proj=longlat +ellps=WGS84
>> +no_defs' Outeniqua.tiff Outeniqua_wgs84.tiff
>>
>> The problem is, that in Outeniqua_wgs84.tiff, the nodata values from
>> Outeniqua.tiff become translated into -9999. In addition, the areas
>> new to Outeniqua_wgs84.tiff (due to the warping) become 1.
>>
>> Which options do I have to use to keep the nodata values and to make
>> the values of the "new areas" also as nodata values?
>
> Rainer,
>
> I believe you want to pass the warp option INIT_DEST=-9999 to set all pixels
> that do not come from the source file to -9999.

Thanks a lot - that solved it partly. I now have all original pixels
unequal to NULL now warped as they should be. Only slight problemk
now: all NULL values from the input file, are now -9999 and I would
prefer to heve them as NULL. I managed that by using gdal_translate
and the -a_nulldata option, but shouldn't that be possible in
gralwarp?

Rainer

>
> This is done with the -wo flag to gdalwarp.
>
> eg.
>
> gdalwarp -wo INIT_DEST=-9999 ...
>
> The avalilable warp options are described in a web page available linked off
> the gdalwarp utility page.
>
> 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    | Geospatial Programmer for Rent
>
>



-- 
Rainer M. Krug, Centre of Excellence for Invasion Biology,
Stellenbosch University, South Africa


More information about the gdal-dev mailing list