Description Usage Arguments Details Value See Also Examples
Analysis of environmental change in space along a movement track.
1 2 3 4 5 6 7 8 9 10 11 |
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. |
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.
A list containing shapefiles with information on environmental change and travel distance/time and a plot of the results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | {
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.