
Last chance! 50% off unlimited learning
Sale ends in
Query environmental data for coordinate pairs.
dataQuery(xy = xy, st = NULL, img = img, rt = NULL, type = NULL,
bs = NULL, rd = FALSE, fun = NULL)
Object of class SpatialPoints or SpatialPointsDataFrame.
Object of class Date with xy observation dates.
Object of class RasterLayer, RasterStack or RasterBrick.
Object of class Date with img observation dates.
One of exact or nearest.
Buffer size (unit depends on the raster projection).
Logical. Should the function ignore duplicated pixels? Default if FALSE.
Passes an external function.
A SpatialPointsDataDataFrame.
Returns environmental variables from a raster object for a given set of x and y coordinates. A buffer size (bs) and a user defined function (fun) can be specified to sample within an area. The defaut is to estimate a weighted mean. If acquisition times are provided (rt) the raster data is treated as a time series. In this case, the function applies one of two sampling approaches: exact or nearest. If exact, the function attempts to map the dates of the raster time series with the observation dates of the samples (ot). If nearest, it searches for the nearest time step. If rd is set, the function will account for duplicated pixels. The samples will be transposed to pixel coordinates and, for each unique pixel, median coordinates will be estimated for each pixel and used to build the output shapefile.
# NOT RUN {
{
require(rgdal)
require(raster)
require(sp)
# read movement data
file <- system.file('extdata', 'konstanz_20130805-20130811.shp', package="rsMove")
moveData <- shapefile(file)
# read remote sensing data
file <- list.files(system.file('extdata', '', package="rsMove"), 'tc.*tif', full.names=TRUE)
rsStk <- stack(file)
# retrieve remote sensing data for samples
rsQuery <- dataQuery(xy=moveData,img=rsStk)
}
# }
Run the code above in your browser using DataLab