Learn R Programming

rsMove (version 0.2.4)

labelSample: labelSample

Description

Pixel-based labeling of spatially connected groups of samples for splitting them between training and validation.

Usage

labelSample(xy, pixel.res, agg.radius = NULL, nr.points = NULL,
  nr.pixels = NULL)

Arguments

xy

Object of class SpatialPoints of SpatialPointsDataFrame.

pixel.res

Pixel resolution or a valid raster layer.

agg.radius

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

nr.points

Minimum number of samples per pixel.

nr.pixels

Minimum number of pixels per region.

Value

A vector of unique identifiers assigning each point in xy to their correspondent pixel region. Filtered observations are returned as NA.

Details

First, the samples are converted to pixel coordinates and removes pixels with a corresponding number of points greater than nr.points. Then, if nr.pixels is set, the connectivity between neighboring samples is evaluated. Internally, the function will label groups of pixels based on their connectivity and regions with a pixel count smaller than the one specified by nr.pixels are excluded. Then, the algorithm aggregates nearby regions using a dilation algorithm within the radius specified by agg.radius and proceeds to reliable the pixels covered by samples. Finally, this information is used to label the original samples provided by xy based on their corresponding pixel coordinates. This analysis is based on the spatial extent of xy and a given pixel resolution (pixel.res). Alternatively, the user may assign a raster object to pixel.res.

References

Remelgado, R., Leutner, B., Safi, K., Sonnenschein, R., Kuebert, C. and Wegmann, M. (2017), Linking animal movement and remote sensing - mapping resource suitability from a remote sensing perspective. Remote Sens Ecol Conserv.

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