Description Usage Arguments Value Author(s) References See Also Examples
Given a series of GOC models built at different scales in a gsGOC
object, visualize the corridor (or shortest path) between two points
using one of the tessellations (i.e. scales) in these models. Visualization is exclusively in vector format. gsGOC
must be run
using the sp=TRUE
option.
1 | gsGOCCorridor(gsGOC, whichThresh, coords, doPlot=FALSE, weight="meanWeight")
|
gsGOC |
A |
whichThresh |
Integer giving the index of the threshold to visualize. |
coords |
A two column matrix or a |
doPlot |
Logical. If |
weight |
The GOC graph link weight to use in calculating the distance. Please see details in |
A list object:
$voronoiSP
vector representation of polygons in the tessellation (SpatialPolygonsDataFrame
)
$linksSP
vector representation of links in the grains of connectivity graph (SpatialLinesDataFrame
)
$nodesSP
vector representation of the nodes in the grains of connectivity graph (SpatialPoints
)
$shortestLinksSP
vector representation of the links in the shortest path between coordinates (SpatialLines
)
$shortestNodesSP
vector representation of the nodes in the shortest path between coordinates (SpatialPoints
)
$corridorLength
gives the length of the shortest path between coordinates in accumulated resistance units
Paul Galpern (pgalpern@gmail.com)
Fall, A., M.-J. Fortin, M. Manseau, D. O'Brien. (2007) Spatial graphs: Principles and applications for habitat connectivity. Ecosystems. 10:448:461
Galpern, P., M. Manseau, P.J. Wilson. (2012) Grains of connectivity: analysis at multiple spatial scales in landscape genetics. Molecular Ecology 21:3996-4009.
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 | ## Not run:
## Load raster landscape
tiny <- raster(system.file("extdata/tiny.asc", package="grainscape"))
## Create a resistance surface from a raster using an is-becomes reclassification
tinyCost <- reclassify(tiny, rcl=cbind(c(1, 2, 3, 4), c(1, 5, 10, 12)))
## Produce a patch-based MPG where patches are resistance features=1
tinyPatchMPG <- gsMPG(cost=tinyCost, patch=tinyCost==1)
## Extract a representative subset of 5 grains of connectivity using sp=TRUE
tinyPatchGOC <- gsGOC(tinyPatchMPG, nThresh=5, sp=TRUE)
## Quick visualization of a corridor
corridorStartEnd <- rbind(c(10,10), c(90,90))
gsGOCCorridor(tinyPatchGOC, whichThresh=3, coords=corridorStartEnd, doPlot=TRUE)
## More control over a corridor visualization
tinyPatchCorridor <- gsGOCCorridor(tinyPatchGOC, whichThresh=3, coords=corridorStartEnd)
plot(tinyPatchCorridor$voronoiSP, col="lightgrey", border="white", lwd=2)
plot(tinyPatchCorridor$linksSP, col="darkred", lty="dashed", add=TRUE)
plot(tinyPatchCorridor$nodesSP, col="darkred", pch=21, bg="white", add=TRUE)
plot(tinyPatchCorridor$shortestLinksSP, col="darkred", lty="solid", lwd=2, add=TRUE)
plot(tinyPatchCorridor$shortestNodesSP, col="darkred", pch=21, bg="darkred", add=TRUE)
mtext(paste("Corridor shortest path length:",
round(tinyPatchCorridor$corridorLength, 2),
"resistance units"), side=1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.