rsMove (version 0.2.8)

spaceDir: spaceDir

Description

Analysis of environmental change in space along a movement track.

Usage

spaceDir(
  x,
  y,
  sample.direction,
  data.type,
  obs.time = NULL,
  distance.method = "m",
  buffer.size = NULL,
  stat.fun = NULL,
  min.count = 2
)

Arguments

x

Object of class SpatialPoints or SpatialPointsDataFrame.

y

Object of class RasterLayer.

sample.direction

One of forward, backward or both. Default is both.

data.type

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

obs.time

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

distance.method

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

buffer.size

Spatial buffer size expressed in the map units.

stat.fun

Output statistical metric.

min.count

Minimum number of pixels required by stat.fun. Default is 2.

Value

A list containing shapefiles with information on environmental change and travel distance/time and a plot of the results.

Details

This function quantifies environmnetal changes in space along a movement track. For each set of consecutive points, the function will derive coordinates for all unique pixels that overlap with - and are beteween - each point in a spatial moving widow with a shape defined by sample.direction. The user can define buffer.size to consider all pixels within a predefined spatial distance of the initially selected pixels. Once all pixels are selected, the function will extract the corresponding values in y summarize them using a pre-defined statistical function. If data.type is cont, a statistical function can be provided through stat.fun. However, if data.type is cat, the function will report on the dominant class and on the shannon index for each window. If the number of pixels within the a window is lower than min.count the function will return NA. On top of this, spaceDir will also report on the linear distance traveled between endpoints (in meters) and the travel time (in minutes). The output of the function is a list consisting of:

  • endpoints - Point shapefile with endpoints of each spatial segment. Reports on a given statistical metric, traveled distance, travel time and the mean timestamp.

  • segments - Line shapefile with spatial segments. Reports on the same information as endpoints. plot - Plotting of segments where each segment is colored according to the extracted raster value.

See Also

timeDir dataQuery imgInt

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)

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

 # perform directional sampling
 of <- function(i) {lm(i~c(1:length(i)))$coefficients[2]}
 s.sample <- spaceDir(shortMove, r, "backward", "cont", obs.time=obs.time, stat.fun=of)

}
# }

Run the code above in your browser using DataLab