labelSample: labelSample

Description Usage Arguments Details Value See Also Examples

View source: R/labelSample.R

Description

Pixel-based labeling of spatially connected groups of points in a SpatialPoints object.

Usage

1
labelSample(x, y, nr.points = 1, nr.pixels = NULL, agg.radius = NULL)

Arguments

x

Object of class SpatialPoints of SpatialPointsDataFrame.

y

Pixel resolution or a valid raster layer.

nr.points

Minimum number of observations per pixel.

nr.pixels

Minimum number of pixels per region.

agg.radius

Minimum radius for pixel aggregation. Unit depends on the projection of the data.

Details

First, the observations are converted to pixel coordinates and pixels with a corresponding number of observations greater than nr.points are filtered out. Then, if nr.pixels is set, the function evaluates the spatial connectivity of the pixels and regions with a pixel count smaller than nr.pixels are filtered out. Then, the algorithm aggregates nearby regions within the distance specified by agg.radius. The final region identifiers are then assigned back to the original observations in x based on their corresponding pixel coordinates. This analysis is based on the spatial extent of x and a given pixel resolution (y). Alternatively, the user may assign a raster object as y assuring that the final output is aligned with it.

Value

A numeric vector with region identifiers for each observation in x to their correspondent pixel region. Filtered observations are returned as NA.

See Also

sampleMove hotMove

Examples

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

 require(raster)

 # read raster data
 r <- raster(system.file('extdata', '2013-07-16_ndvi.tif', package="rsMove"))

 # read movement data
 data(shortMove)

 # derive region labels
 labels <- labelSample(shortMove, r, agg.radius=60)

}

RRemelgado/rsMove documentation built on June 7, 2020, 5:12 p.m.