Description Usage Arguments Details Value Note Author(s) References See Also Examples
This function is used to extract a minimum planar graph (MPG) in strips, and can be used as an alternative
to gsMPG
. It can save time where there are a large number of patches by dividing
the landscape into a number of strips and stitching them back together. It can also extract MPGs for each strip in parallel (with the parallel package
).
Using this function is necessary when there are a very large number of patches (usually in excess of 2000), as SELES
and consequently gsMPG
will fail on such landscapes.
Stripping and extracting separate MPGs may sometimes result in small artefactual differences in graph topology
and Voronoi tessellations. Researchers may wish to quantify the impact of stripping by using a
small subregion of their landscape, and comparing the results from gsMPG(x)
and
gsMPGstrip(x, numStrips=2, ...)
.
Note that gsMPGstitch
cannot be used to generate MPGs for use in lattice-based grains of
connectivity modelling. gsMPG
must be used for this purpose.
1 2 3 | gsMPGstitch(cost, patchid, numStrips, percentOverlap,
disttype="Cost", cpu=1, outputFolder=NULL, filterPatch=NULL,
spreadFactor=0, selesPath = system.file("SELES", package = "grainscape"))
|
cost |
A raster of class |
patchid |
PLEASE WRITE. Note that it is different from gsMPG which requires a binary patch raster as input. |
numStrips |
PLEASE WRITE |
percentOverlap |
PLEASE WRITE |
disttype |
PLEASE WRITE |
cpu |
For parallel computation of each MPG strip. If |
outputFolder |
Optional. If not supplied this function creates files for use by |
filterPatch |
Optional. Remove patches from the analysis that are smaller than a given number of cells. |
spreadFactor |
Optional. Fine-grained control over the accuracy of Voronoi polygons. To reduce accuracy and increase speed,
set this as |
selesPath |
Optional. The location of the |
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 gsMPG
object, consisting of a list of objects.
The main elements:
$mpg
is the minimum planar graph as class igraph
$patchId
is the input patch
raster with patch cells assigned to their id (RasterLayer
)
$voronoi
is the Voronoi tessellation of the patches and resistance surface (RasterLayer
)
$lcpPerimWeight
gives the paths of the links between patches and their accumulated costs (RasterLayer
)
$lcpLinkId
gives the paths of the links between patches and their id (RasterLayer
)
$lcpPerimType
gives the paths of the links between patches and their type (RasterLayer
; see notes)
$mpgPlot
provides a quick way of visualizing the mpg (RasterLayer
)
The $mpg
has useful vertex and edge attributes. Vertex attributes give attributes of patches including patch area, the area of patch edges, the
core area of each patch, and the coordinates of the patch centroid. All areal measurements are given as raster cell counts.
Edge attributes give attributes of the graph links including
link weights giving accumulated resistance/least-cost path distance, Euclidean distance, and the start and end coordinates of
each link.
SELES has been compiled for Windows. Therefore use of gsMPG
is limited to Windows-based platforms.
MORE DETAILS IN HERE
Four types of links are identified in the MPG (1=Nearest neighbour; 2=Minimum spanning tree; 3=Gabriel; 4=Delaunay;)
Areal measurements are given as raster cell counts. If the raster projection is one where cell sizes are approximately
constant in area (e.g. UTM), or the raster covers a relatively small geographic extent (e.g. < 1000 km in dimension)
areal measurements will often be adequate. Reprojection of rasters should be considered to minimize
these effects in other cases (see projectRaster
).
Bronwyn Rayfield (bronwyn.rayfield@mail.mcgill.ca), Paul Galpern (pgalpern@gmail.com), Andrew Fall
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 | ## Not run:
## Create a resistance surface
frag <- raster(system.file("extdata/fragmented.asc", package="grainscape"))
fragCost <- reclassify(frag, rcl=cbind(c(1,2,3,4), c(1,10,8,3)))
## Unlike with gsMPG() it is necessary to create a patchid raster
## before-hand. This can be done with raster::clump()
fragPatchId <- raster::clump(fragCost==1, directions=8, gaps=FALSE)
fragPatchId[is.na(fragPatchId[])] <- 0
## Create an MPG graph by stitching together 3 strips
## Do this in parallel with two processor cores
fragMPGstitch <- gsMPGstitch(cost=fragCost, patchid=fragPatchId,
numStrips=3, percentOverlap=50, outputFolder=NULL, cpu=2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.