[Gdal-dev] Excluding the nodata value from gdalwarp interpolation

Stanley Glidden stanley at fresco.sr.unh.edu
Sun Apr 8 01:23:35 EDT 2007


Hi,

Can someone tell me the proper way to keep the nodata value from being 
interpolated by gdalwarp when using bilinear or cubic resampling. What I 
tried does not seem to work. I thought the -srcnodata flag would take care 
of this?


Thanks,

--Stanley Glidden

<Example of 4x4 matrix before and after gdalwarp>

gdalwarp -srcnodata -9999 -dstnodata -9999 -t_srs 'EPSG:2823' -s_srs 
'EPSG:4326' -of VRT -rb test.asc test2.vrt

gdal_translate -a_nodata -9999 -of AAIGrid test2.vrt test2.asc


#(input) test.asc
#ncols 4
#nrows 4
#xllcorner -70
#yllcorner 40
#cellsize .1
#NODATA_value -9999
#1 2 3 4
#5 -9999 7 8
#9 10 11 12
#13 14 15 16

#(result) test2.asc
#ncols        4
#nrows        5
#xllcorner    441487.734861204110
#yllcorner    -280657.303193560336
#cellsize     9896.947051239924
#NODATA_value  -9999
# 1 2 3 4
# -389 -6344 7 7
# -84 -2454 10 11
# 11 13 14 15
# 13 14 15 16




-- 
Water Systems Analysis Group
University of New Hampshire



More information about the Gdal-dev mailing list