Learn R Programming

rsMove (version 0.1)

dataQuery: dataQuery

Description

Query environmental data for coordinate pairs.

Usage

dataQuery(xy = xy, st = NULL, img = img, rt = NULL, type = NULL,
  bs = NULL, rd = FALSE, fun = NULL)

Arguments

xy

Object of class SpatialPoints or SpatialPointsDataFrame.

st

Object of class Date with xy observation dates.

img

Object of class RasterLayer, RasterStack or RasterBrick.

rt

Object of class Date with img observation dates.

type

One of exact or nearest.

bs

Buffer size (unit depends on the raster projection).

rd

Logical. Should the function ignore duplicated pixels? Default if FALSE.

fun

Passes an external function.

Value

A SpatialPointsDataDataFrame.

Details

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.

See Also

sampleMove backSample

Examples

Run this code
# 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