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

Paul Hiemstra p.hiemstra at geo.uu.nl
Sat Nov 21 09:34:27 CET 2009


Hi Ned,

Is it an option to switch to another GDAL format, GTiff for example? 
Check if this exports the NA values correctly. Not really an answer to 
your question, but maybe a helpful suggestion.

cheers and good luck,
Paul

Ned Horning wrote:
> 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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



More information about the R-sig-Geo mailing list