Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

asciigrid

read/write to/from (ESRI) asciigrid format


Description

read/write to/from ESRI asciigrid format

Usage

read.asciigrid(fname, as.image = FALSE, plot.image = FALSE, colname = fname,
 proj4string = CRS(as.character(NA)))
write.asciigrid(x, fname, attr = 1, na.value = -9999, ...)

Arguments

fname

file name

as.image

logical; if FALSE, a list is returned, ready to be shown with the image command; if FALSE an object of class SpatialGridDataFrame-class is returned

plot.image

logical; if TRUE, an image of the map is plotted

colname

alternative name for data column if not file name

proj4string

A CRS object setting the projection arguments of the Spatial Grid returned

x

object of class SpatialGridDataFrame

attr

attribute column; if missing, the first column is taken; a name or a column number may be given

na.value

numeric; value given to missing valued cells in the resulting map

...

arguments passed to write.table, which is used to write the numeric data

Value

read.asciigrid returns the grid map read; either as an object of class SpatialGridDataFrame-class or, if as.image is TRUE, as list with components x, y and z.

Author(s)

Edzer Pebesma

See Also

Examples

x <- read.asciigrid(system.file("external/test.ag", package="sp")[1])
class(x)
image(x)

sp

Classes and Methods for Spatial Data

v1.4-5
GPL (>= 2)
Authors
Edzer Pebesma [aut, cre], Roger Bivand [aut], Barry Rowlingson [ctb], Virgilio Gomez-Rubio [ctb], Robert Hijmans [ctb], Michael Sumner [ctb], Don MacQueen [ctb], Jim Lemon [ctb], Finn Lindgren [ctb], Josh O'Brien [ctb], Joseph O'Rourke [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.