View source: R/create_wide_lcp.R
create_wide_lcp  R Documentation 
Calculates a wide least cost path from an origin location to a destination location. Applies Dijkstra's algorithm. See details for more information
create_wide_lcp( cost_surface, origin, destination, neighbours = 16, path_ncells )
cost_surface 

origin 

destination 

neighbours 

path_ncells 

The calculation of a wide least cost path is inspired by Shirabe (2015).Instead of calculating a least cost path where the path width is assumed to be zero or negligible compared to the cell size, create_wide_lcp creates a wide least cost path where the path is calculated based on a cost surface that incorporates the total permeability of passage from adjacent cells
The algorithm proceeds as follows:
Each column of the supplied cost surface is summed, resulting in a raster with each cell representing the total permeability of passage from each adjacent neighbour (adjacent cells specificed when creating cost surface through the use of wide_path_matirx(). A transitionMatrix is created from this total permeability of passage raster, with the permeability of movement between cells based on the total permeability raster. That is, moving into each cell regardless of direction will incur the same cost.
Using this total permeability of passage cost surface, the least cost path can be calculated. This represents the least cost path between two locations based on the total permeability of passage cost surface that incorporates the summed permeability of passage. To visualise the wide least cost path, the least cost path is represented as a polygon with the width as supplied in the path_ncells argument.
SpatialPolygons
(sp package). The resultant object is the shortest wide path route (i.e. least cost) between origin and destination
Joseph Lewis
Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik. 1: 269271.
Shirabe, T. (2015). A method for finding a leastcost wide path in raster space. International Journal of Geographical Information Science 30, 14691485. doi: 10.1080/13658816.2015.1124435
r < raster::raster(system.file('external/maungawhau.grd', package = 'gdistance')) n < 3 slope_cs < create_slope_cs(r, cost_function = 'tobler', neighbours = wide_path_matrix(n)) loc1 = cbind(2667670, 6479000) loc1 = sp::SpatialPoints(loc1) loc2 = cbind(2667800, 6479400) loc2 = sp::SpatialPoints(loc2) lcps < create_wide_lcp(cost_surface = slope_cs, origin = loc1, destination = loc2, path_ncells = n)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.