rsMove (version 0.2.8)

labelSample: labelSample

Description

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

Usage

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.

Value

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

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.

See Also

sampleMove hotMove

Examples

Run this code
# NOT RUN {
{

 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)

}
# }

Run the code above in your browser using DataLab