MPG | R Documentation |
Extracts a minimum planar graph (MPG) and is also the first step in grains of connectivity (GOC) modelling. Both patch-based and lattice MPGs can be extracted.
MPG(cost, patch, ...)
## S4 method for signature 'RasterLayer,RasterLayer'
MPG(cost, patch, ...)
## S4 method for signature 'RasterLayer,numeric'
MPG(cost, patch, ...)
cost |
A |
patch |
A raster of class |
... |
Additional arguments (not used). |
Use this function to create a minimum planar graph (MPG) that can be
further analyzed using igraph()
routines.
It is also the first step in grains of connectivity (GOC) modelling.
A mpg()
object.
Researchers should consider whether the use of a patch-based MPG or a lattice MPG model is appropriate based on the patch-dependency of the organism under study. Patch-based models make most sense when animals are restricted to, or dependent on, a resource patch. Lattice models can be used as a generalized and functional approach to scaling resistance surfaces.
Rasters should be projected and not in geographic coordinates (i.e. projection(cost)
should not contain "+proj=longlat"
) or the function will issue a warning.
In unprojected cases consider using projectRaster()
to change to an appropriate
coordinate system for the location and extent of interest that balances both distance and areal
accuracy. See https://www.spatialreference.org/ for location-specific suggestions.
Use of geographic coordinates will result in inaccurate areal and distance measurements,
rendering the models themselves inaccurate.
Paul Galpern, Sam Doctolero, Alex Chubaty
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. (2013a) Finding the functional grain: comparing methods for scaling resistance surfaces. Landscape Ecology 28:1269-1291.
Galpern, P., M. Manseau. (2013b) Modelling the influence of landscape connectivity on animal distribution: a functional grain approach. Ecography 36:1004-1016.
Galpern, P., M. Manseau, A. Fall. (2011) Patch-based graphs of landscape connectivity: a guide to construction, analysis, and application for conservation. Biological Conservation 144:44-55.
Galpern, P., M. Manseau, P.J. Wilson. (2012) Grains of connectivity: analysis at multiple spatial scales in landscape genetics. Molecular Ecology 21:3996-4009.
[GOC], [threshold]
## Load raster landscape
tiny <- raster::raster(system.file("extdata/tiny.asc", package = "grainscape"))
## Create a resistance surface from a raster using an is-becomes reclassification
tinyCost <- raster::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 <- MPG(cost = tinyCost, patch = tinyCost == 1)
## Explore the graph structure and node/link attributes
graphdf(tinyPatchMPG)
## Find the mean patch area (see igraph manual for use of V() and E())
mean(igraph::V(tinyPatchMPG@mpg)$patchArea)
## Quick visualization of the MPG
if (interactive())
plot(tinyPatchMPG, col = c("grey", "black"), legend = FALSE)
## Additional graph extraction scenarios
## Produce a lattice MPG where focal points are spaced 10 cells apart
tinyLatticeMPG <- MPG(cost = tinyCost, patch = 10)
if (interactive())
plot(tinyLatticeMPG)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.