raster (version 1.1.7)

edge: Edge detection

Description

Detect edges. Edges are those cells who have more than one class in the 9 cells surrounding it, or, if classes=FALSE, cells with values and cells with NA.

Usage

edge(x, ...)

Arguments

x
a Raster* object
...
Additional arguments, see Details

Value

  • a RasterLayer. Cell values are either 1 (and edge) or 0 (not an edge)

Details

The following additional arguments can be passed: rll{ classes Logical. If TRUE all different values are (after rounding) distinguished, as well as NA. If FALSE, the only comparison is between values and NA type Character. 'both' (default), 'inner', or 'outer' to distinguish cells with values versus cells with NA. asNA Logical. Should non-edge cells by NA rather than FALSE (zero)? asZero Logical. If asNA=TRUE, should cells that are not an edge, and not NA on the input RasterLayer be returned as zero? filename Character. Filename for the output RasterLayer format Character. Output file type. See writeRaster datatype Character. Output data type. See dataType overwrite Logical. If TRUE, "filename" will be overwritten if it exists progress Character. Valid values are "text", "tcltk", "windows" (on that platform only) and "" }

See Also

focal, clump

Examples

Run this code
r <- raster(nrow=18, ncol=36)
r[] <- round(c(1:324, 324:1)/324)
r[r==0] <- NA
e <- edge(r, type='inner', asNA=TRUE, asZero=TRUE)

Run the code above in your browser using DataCamp Workspace