summarize_lcps {quadtree} | R Documentation |
Get a matrix summarizing all LCPs found by a LcpFinder
Description
Given a LcpFinder
, returns a matrix that
summarizes all of the LCPs that have been calculated by the
LcpFinder
.
Usage
## S4 method for signature 'LcpFinder'
summarize_lcps(x)
Arguments
x |
Details
Note that this function returns all of the paths that have
been calculated. Finding one LCP likely involves finding other LCPs as
well. Thus, even if the LcpFinder
has been used to find one
LCP, others have most likely been calculated. This function returns all of
the LCPs that have been calculated so far.
Value
Returns a nine-column matrix with one row for each LCP (and therefore one row per destination cell). The columns are as follows:
id
: the ID of the destination cellxmin, xmax, ymin, ymax
: the extent of the destination cellvalue
: the value of the destination cellarea
: the area of the destination celllcp_cost
: the cumulative cost of the LCP to this celllcp_dist
: the cumulative distance of the LCP to this cell - note that this is not straight-line distance, but instead the distance along the path
See Also
lcp_finder()
creates the LcpFinder
object used as input to this function. find_lcp()
returns the
LCP between the start point and another point. find_lcps()
calculates all LCPs whose cost-distance is less than some value.
Examples
library(quadtree)
habitat <- terra::rast(system.file("extdata", "habitat.tif", package="quadtree"))
qt <- quadtree(habitat, split_threshold = .1, adj_type = "expand")
start_pt <- c(19000, 25000)
end_pt <- c(33015, 38162)
# find LCP from 'start_pt' to 'end_pt'
lcpf <- lcp_finder(qt, start_pt)
lcp <- find_lcp(lcpf, end_pt)
# retrieve ALL the paths that have been calculated
paths <- summarize_lcps(lcpf)
head(paths)