[R-sig-Geo] Reading an Ascii file

Juliane Struve juliane_struve at yahoo.co.uk
Wed Jan 14 18:01:26 CET 2009


Dear list,

I am trying to read ArcGIS raster data sets into R after converting them into ASCII .txt file. The text file I am trying to read contains 

ncols         250
nrows         276
xllcorner     344147.19411119
yllcorner     3024657.6122834
cellsize      0.19970250725746
NODATA_value  -9999

in the first lines followed by a grid of values that are either -9999 or 1. 

I have used read.table("myfile.txt") which yields this (first 10 lines).


V1            V2
1          ncols  2.500000e+02
2          nrows  2.760000e+02
3      xllcorner  3.441472e+05
4      yllcorner  3.024658e+06
5       cellsize  1.997025e-01
6      NODATA_value -9.999000e+03
7          -9999 -9.999000e+03
8          -9999 -9.999000e+03
9          -9999 -9.999000e+03
10        -9999 -9.999000e+03

I would like to have the data as a table with coordinates for each cell and the actual value.

Could somebody advise me which function I should use ? 

Many thanks,

Juliane 







More information about the R-sig-Geo mailing list