rsMove (version 0.2.1)

spaceDir: spaceDir

Description

Spatial directional raster analysis.

Usage

spaceDir(xy = xy, ot = NULL, img = img, dir = dir, type = type,
  dm = "m", b.size = NULL, fun = NULL, npx = 2)

Arguments

xy

Object of class SpatialPoints or SpatialPointsDataFrame.

ot

Object of class Date, POSIXlt or POSIXct with xy observation dates.

img

Object of class RasterLayer.

dir

One of fwd, bwd or both. Default is both.

type

One of 'cont' or 'cat'. Defines which type of variable is in use.

dm

One of 'm' or 'deg' specifying the projection unit. Default is 'm'.

b.size

Buffer size expressed in the map units.

fun

Summary function.

npx

Minimum number of pixels used in fun. Default is 2.

Value

A list.

Details

This function evaluates how do environmental conditions change in space along a movement track. First, it looks at consectuve observations to define spatial segments. All the pixels between the two endpoints of the segment are considered in this process. The user can use the argument dir to prompt the function to focus on previous (bwd) or following (fwd) observations or to look in both directions (both) when defining the segments. The output consists of a list containing two shapefiles, one SpatialPointsDataFrame ($endpoints) with the endpoints of each segment and a SpatialLinesDataFrame ($segments) representing each segment. The data frames provided with these shapefiles reports on:

  • x - mean x coordinates

  • y - mean y coordinates

  • timestamp - mean observation time

  • pixel.time - elapsed time within a pixel for a given segment

  • travel.distance - distance between a segment endpoints

  • travel.time - elapsed time between a segment endpoints

The additionaly information added to the data frame depends on the type of data. If type is set to 'cont', the function will assume the input raster is a continuous variable as estimate a statistical metric for each segment. If none is provided throught the keyword fun, the slope will be returned by default and assigned to the column 'stat' within the output data frame. If type is set to ''cat', the function will assume the data is categorical. As a result, the keyword fun is ignored. Instead, the function will return the proportion of pixels occupied by each class for each segment. In addition, the dominant class ('main') and the shannon index ('shannon') will be returned for each segment within the output data frame. In order to include the area surrounding the sample points in this analysis, d.buffer can be used. This keyword dilates the interpolated sample points by a given distance transforming the initial line into a polygon. @note If d.buffer is used, the default fun (the slope) is not adequate given that spatial order of the samples is not preserved. This should be considered when using these keywords simulaneously,

See Also

timeDir dataQuery imgInt

Examples

Run this code
# NOT RUN {
{

 require(raster)

 # read raster data
 r <- raster(system.file('extdata', 'tcb_1.tif', package="rsMove"))

 # read movement data
 moveData <- read.csv(system.file('extdata', 'konstanz_20130804.csv', package="rsMove"))
 moveData <- SpatialPointsDataFrame(moveData[,1:2], moveData, proj4string=crs(r))

 # observation time
 ot <- strptime(paste0(moveData@data$date, ' ',moveData@data$time), format="%Y/%m/%d %H:%M:%S")

 # perform directional sampling
 of <- function(x) {lm(x~c(1:length(x)))$coefficients[2]}
 s.sample <- spaceDir(xy=moveData, ot=ot, img=r, dir="bwd", type='cont', fun=of)

}
# }

Run the code above in your browser using DataLab