processRanges(con,...)
rangeMapper
project.SpatialPolygonsDataFrame
object containing all the ranges.
ID when spdf is set this is a character
veoverlay
. 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.rangeMapper
rangeTraits
metadataUpdate
.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