Learn R Programming

rangeMapper (version 0.2-0)

processRanges: Process ranges

Description

Each polygon range is overlayed on the canvas and the results are saved to the active project file.

Usage

processRanges(con,...)

Arguments

con
An sqlite connection pointing to a valid rangeMapper project.
...
Arguments to pass to the corresponding methods: spdf SpatialPolygonsDataFrame object containing all the ranges. ID when spdf is set this is a character ve

Details

The overlay is performed using overlay. If the overlay returns no results (i.e. the polygon is smaller than a grid cell) then the centroid of the range will snap to the nearest point and only one grid cell will be returned for that range.

References

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)

See Also

rangeMapper rangeTraits metadataUpdate.

Examples

Run this code
require(rangeMapper)
wd = tempdir()

# Multiple files (one file per range)
rdr= system.file(package = "rangeMapper", "extdata", "wrens", "vector")
dbcon = rangeMap.start(file = "wrens.sqlite", overwrite = TRUE, dir = wd)
global.bbox.save(con = dbcon, bbox = rdr)
gridSize.save(dbcon) ; canvas.save(dbcon) 
system.time(processRanges(dir = rdr, con =  dbcon))

# One file containing all the ranges
r = readOGR(system.file(package = "rangeMapper", "extdata", "wrens", "vector_combined"), "wrens", verbose = FALSE)

dbcon = rangeMap.start(file = "wrens.sqlite", overwrite = TRUE, dir = wd )
global.bbox.save(con = dbcon, bbox = r)
gridSize.save(dbcon)  
canvas.save(dbcon) 

system.time(processRanges(spdf = r, con =  dbcon, ID = "sci_name" ))
# ~ 12 times faster than processing individual ranges.

Run the code above in your browser using DataLab