gsGOCCorridor: Visualize corridors between two points using a grains of...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/grainscape.R

Description

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.

Usage

1
gsGOCCorridor(gsGOC, whichThresh, coords, doPlot=FALSE, weight="meanWeight")

Arguments

gsGOC

A gsGOC object created by gsGOC

whichThresh

Integer giving the index of the threshold to visualize.

coords

A two column matrix or a SpatialPoints object giving coordinates at the end points of the corridor

doPlot

Logical. If TRUE plots a vector visualization of the corridor at the given scale. For full control, manually produce plots using the outputs of this function.

weight

The GOC graph link weight to use in calculating the distance. Please see details in gsGOCDistance.

Value

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

Author(s)

Paul Galpern (pgalpern@gmail.com)

References

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.

See Also

gsGOC gsGOCVisualize

Examples

 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)

grainscape documentation built on May 2, 2019, 6:48 p.m.