rsMove (version 0.2.1)

dataQuery: dataQuery

Description

Query environmental data for coordinate pairs.

Usage

dataQuery(xy = xy, st = NULL, img = img, rt = NULL, tb = NULL,
  bs = NULL, 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.

tb

Two element vector with temporal search buffer, expressed in days.

bs

Buffer size (unit depends on the raster projection).

fun

Passes an external function.

Value

A n object of class vector or data.frame.

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 raster acquisition times are provided (rt) and the date of sampling (st). In this case, the function will treat the raster data as a time series and search for clear pixel in time within the contraints of a temporal buffer defined by tb. tb passes two values which represent the size of the buffer in two directions: before and after the target date. This allows for bacward and forward sampling.

See Also

sampleMove backSample

Examples

Run this code
# NOT RUN {
{
 
 require(raster)
 
 # read raster data
 file <- list.files(system.file('extdata', '', package="rsMove"), 'tc.*tif', full.names=TRUE)
 rsStk <- stack(file)
 rsStk <- stack(rsStk, rsStk, rsStk) # dummy files for the example
 
 # read movement data
 moveData <- read.csv(system.file('extdata', 'konstanz_20130805-20130811.csv', package="rsMove"))
 moveData <- SpatialPointsDataFrame(moveData[1:10,1:2], moveData[1:10,], proj4string=crs(rsStk))
 
 # raster dates
 r.date <- seq.Date(as.Date("2013-08-01"), as.Date("2013-08-09"), 1)
 
 # sample dates
 o.date <- as.Date(moveData@data$date)
 
 # retrieve remote sensing data for samples
 rsQuery <- dataQuery(xy=moveData, st=o.date, img=rsStk, rt=r.date, tb=c(30,30))

}

# }

Run the code above in your browser using DataCamp Workspace