Learn R Programming

leastcostpath (version 1.7.4)

create_cost_corridor: Create a Cost Corridor

Description

Combines the accumulated cost surfaces from origin-to-destination and destination-to-origin to identify areas of preferential movement that takes into account both directions of movement.

Usage

create_cost_corridor(cost_surface, origin, destination, rescale = FALSE)

Arguments

cost_surface

TransitionLayer (gdistance package). Cost surface to be used in Cost Corridor calculation

origin

SpatialPoints* (sp package). orgin location from which the Accumulated Cost is calculated. Only the first cell is taken into account.

destination

SpatialPoints* (sp package). destination location from which the Accumulated Cost is calculated. Only the first cell is taken into account

rescale

logical. if TRUE raster values scaled to between 0 and 1. Default is FALSE

Value

RasterLayer (raster package). The resultant object is the accumulated cost surface from origin-to-destination and destination-to-origin and can be used to identify areas of preferential movement in the landscape.

Examples

Run this code
# NOT RUN {
r <- raster::raster(system.file('external/maungawhau.grd', package = 'gdistance'))
slope_cs <- create_slope_cs(r, cost_function = 'tobler', neighbours = 16)

loc1 = cbind(2667670, 6479000)
loc1 = sp::SpatialPoints(loc1)

loc2 = cbind(2667800, 6479400)
loc2 = sp::SpatialPoints(loc2)

cost_corridor <- create_cost_corridor(slope_cs, loc1, loc2, rescale = FALSE)
# }

Run the code above in your browser using DataLab