rasterToPoints

0th

Percentile

Raster to points conversion

Raster to point conversion. Cells with NA are not converted. A function can be used to select a subset of the raster cells (by their values).

Keywords
spatial
Usage
rasterToPoints(x, fun=NULL, spatial=FALSE, ...)
Arguments
x

A Raster* object

fun

Function to select a subset of raster values

spatial

Logical. If TRUE, the function returns a SpatialPointsDataFrame object

...

Additional arguments. Currently only progress to specify a progress bar. "text", "window", or "" (the default, no progress bar)

Details

fun should be a simple function returning a logical value.

E.g.: fun=function(x){x==1} or fun=function(x){x>3}

Value

A matrix with three columns: x, y, and v (value), or a SpatialPointsDataFrame object

Aliases
  • rasterToPoints
Examples
# NOT RUN {
r <- raster(nrow=18, ncol=36)
r[] <- runif(ncell(r)) * 10
r[r>8] <- NA
p <- rasterToPoints(r)
p <- rasterToPoints(r, fun=function(x){x>6})
#plot(r)
#points(p)
# }
Documentation reproduced from package raster, version 2.9-5, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.