lcp_graph_surface | R Documentation |
This function constructs a graph for least-cost paths analysis. This function is specifically designed for situations in which the aim is to calculate least-cost distances between points on a raster
.
lcp_graph_surface(surface, cost, verbose = TRUE)
surface |
A |
cost |
A sparse |
verbose |
A logical function that defines whether or not to print messages to the console to relay function progress. |
This is a wrapper for the makegraph
function.
The function returns a named list that defines the graph (see makegraph
)
Edward Lavender
#### Step (1): Define cost surface
# We will consider the distances between connected cells in the example
# ... 'dat_gebco' raster as a measure of cost. For this, we will focus on a
# ... specific area (for speed), within which we need to
# ... we need to regularise the resolution:
boundaries <- raster::extent(707884.6, 709884.6, 6253404, 6255404)
blank <- raster::raster(boundaries, res = c(5, 5))
r <- raster::resample(dat_gebco, blank)
# Define costs
costs <- lcp_costs(r)
#### Step (2): Make graph for LCP analysis
graph <- lcp_graph_surface(surface = r, cost = costs$dist_total)
#### Step (3): Implement LCP analysis around point on Raster*
# ... e.g., via lcp_from_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.