raster2sample: raster2sample

Description Usage Arguments Details Value See Also Examples

View source: R/raster2sample.R

Description

Converts a raster grid to points.

Usage

1

Arguments

x

Object of class SpatialPolygons or SpatialPolygonDataFrame.

Details

poly2Sample extends on the rasterToPoints function from the raster package. For each non-NA pixel in x, the function will use 3x3 moving window and report on the frequency of non-NA pixels. This can be useful to identify "pure" samples within a clump of pixels (i.e. high frequency) as well as mixed pixels along their borders (i.e. low frequency). The output is a SpatialPointsDataFrame reporting on:

Value

A SpatialPointsDataFrame with sampled pixels reporting on pixel compactness.

See Also

poly2sample ccLabel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{

 require(raster)

 # load example image
 r <- raster(system.file("extdata", "ndvi.tif", package="fieldRS")[1])
 r[r < 5000] <- NA
 
 # extract samples
 samples <- raster2sample(r)

}

RRemelgado/fieldRS documentation built on June 5, 2020, 1:48 p.m.