mp2xy: Back-transform RAMAS Metapop coordinates

Description Usage Arguments Value Note See Also Examples

View source: R/mp2xy.R

Description

Extracts population coordinates from a RAMAS Metapop .mp file, and converts them back to the coordinate system of the original habitat suitability grids (i.e. the grids supplied to the RAMAS patch-identification module, patch.exe or, in more recent versions of RAMAS GIS, SpatialData.exe).

Usage

1
mp2xy(mp, r, cell.length, plot = TRUE)

Arguments

mp

A character string containing the path to a RAMAS Metapop .mp file.

r

Either a character string containing the path to any of the raster files that were used by RAMAS Spatial Data for patch identification, or a Raster* object that was used for that purpose.

cell.length

Numeric. The cell length of the grid, as specified in RAMAS Spatial Data (note: this may be different to the native resolution of the grids).

plot

Logical. Should the points be plotted? If r is a Raster* object with more than one layer, the first layer will be plotted.

Value

A data.frame containing the names of all populations referred to in the .mp file, as well as their coordinates (in both Metapop and original coordinate systems). If plot is TRUE, a plot of the raster layer, r, overlaid with points for all populations in the metapopulation, is also produced.

Note

mptools has been tested with outputs generated by RAMAS Metapop version 5, and may produce unexpected results for other versions. A warning is issued if the user attempts to access files originating from other versions of RAMAS Metapop. It is advised to verify that the returned coordinates are sensible by referring to the plot that is returned by this function.

See Also

mp2sp

Examples

1
2
3
mp <- system.file('example.mp', package='mptools')
r <- system.file('example_001.tif', package='mptools')
coords <- mp2xy(mp, r, 9.975)

mptools documentation built on May 29, 2017, 8:43 p.m.