-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcp_graph_surface.Rd
46 lines (41 loc) · 1.96 KB
/
lcp_graph_surface.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/lcps.R
\name{lcp_graph_surface}
\alias{lcp_graph_surface}
\title{Construct a graph for least-cost paths analysis of movement from a point on a Raster*}
\usage{
lcp_graph_surface(surface, cost, verbose = TRUE)
}
\arguments{
\item{surface}{A \code{\link[raster]{raster}} for which to construct the graph. There are some constraints on the form of this raster if the costs of movement between cells are derived from \code{\link[flapper]{lcp_costs}} (see below).}
\item{cost}{A sparse \code{\link[Matrix]{dsCMatrix-class}} matrix that defines the cost of movement between connected cells on the \code{surface} (see \code{\link[flapper]{lcp_costs}}).}
\item{verbose}{A logical function that defines whether or not to print messages to the console to relay function progress.}
}
\value{
The function returns a named list that defines the graph (see \code{\link[cppRouting]{makegraph}})
}
\description{
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 \code{\link[raster]{raster}}.
}
\details{
This is a wrapper for the \code{\link[cppRouting]{makegraph}} function.
}
\examples{
#### 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()
}
\author{
Edward Lavender
}