Learn R Programming

mptools (version 1.0.1)

mp2xy: Back-transform RAMAS Metapop coordinates

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

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.

See Also

mp2sp

Examples

Run this code
mp <- system.file('example.mp', package='mptools')
r <- system.file('example_001.tif', package='mptools')
coords <- mp2xy(mp, r, 9.975)

Run the code above in your browser using DataLab