Description Usage Arguments Value Note Author(s) References See Also Examples
Updates metadata_table
of a rangeMapper
project after importing ranges with processRanges
.
1 | metadata.update(rangeMap, FUN, name, map, overwrite = FALSE, ...)
|
rangeMap |
A |
FUN |
Function used to aggregate the map values corresponding to each range |
name |
The name of the new |
map |
Single-band |
overwrite |
If set to |
... |
extra arguments (e.g. |
Nothing is returned.
In order to compute taxa-level metadata which are not dependent on the project's resolution use
processRanges
with a metadata
argument. See rangeTraits
for more details.
The method can be extended to work with raster or vector objects (e.g. lines, polygons, points)
using overlaying functions in the package raster
and rgeos
respectively.
Mihai Valcu valcu@orn.mpg.de
Valcu, M., Dale, J. and Kempenaers, B. (2012) rangeMapper: A platform for the study of macroecology of life history traits. 21(9). (DOI: 10.1111/j.1466-8238.2011.00739.x)
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 32 33 34 | require(rangeMapper)
# data
spdf = readOGR(system.file(package = "rangeMapper",
"extdata", "wrens", "vector_combined"), "wrens", verbose = FALSE)
rloc = system.file(package = "rangeMapper", "extdata",
"etopo1", "etopo1_Americas.tif")
r = readGDAL(rloc, output.dim = c(50, 50))
spdf = spTransform(spdf, CRS(proj4string(r)) )
# the project
dbcon = rangeMap.start(file = "wrens.sqlite", overwrite = TRUE,
dir = tempdir() )
rmap = new("rangeMap", CON = dbcon)
global.bbox.save(con = dbcon, bbox = spdf )
gridSize.save(dbcon, gridSize = 300000)
canvas.save(dbcon)
processRanges(spdf = spdf, con = dbcon, ID = "sci_name" )
# metadata.update
metadata.update (rmap,
FUN = function(x, ...) {
res = diff(range(x, ...))
if( !is.finite(res)) res = 0
res
},
name = 'AltitudeRange', map = r, na.rm = TRUE, overwrite = TRUE)
# plot
mr = RMQuery(dbcon, 'select * from metadata_ranges')
maxRangeSp = mr[mr$AltitudeRange== max(mr$AltitudeRange), 'bioid']
image(r)
plot(rangeFetch(rmap, maxRangeSp), add = TRUE, border = 4, lwd = 3)
title(main = maxRangeSp)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.