[R-sig-Geo] Writing an ASCII grid with nodata values

Ned Horning horning at amnh.org
Fri Nov 20 18:58:34 CET 2009


I am trying to export a SpatialPixelsDataFrame object with floating 
point values to an ASCII grid file and want to specify a nodata value. I 
tried write.asciigrid from the sp package and I couldn't figure out how 
to output float values. The pixel values exported as integers.

For now I am using the following writeGDAL statement:
--
writeGDAL(sp_hsm_pard, out_pard, drivername="AAIGrid", type="Float32", 
options="DECIMAL_PRECISION=3", "NODATA=-9999")

--
This appears to output the image okay but it is not assigning the proper 
values to NODATA_value. The NODATA_value in the exported file is "1" 
instead of "-9999".

Can someone let me know how to output floating point data to an ESRI 
ASCII grid file and specify a nodata value.

Thanks,

Ned



More information about the R-sig-Geo mailing list