Learn R Programming

rangeMapper (version 0.2-6)

assemblageFetch-methods: Function assemblageFetch retrieves the species set of an arbitrary canvas cell

Description

Function assemblageFetch retrieves the species set, and the data associated with it, of an arbitrary canvas cell optionally with the associated life history data

Arguments

Examples

Run this code
require(rangeMapper)

projName = "wrens.sqlite"
projLoc = paste(tempdir(), projName, sep = .Platform$file.sep)

dbcon = rangeMap.start(file = projName,dir = tempdir() , overwrite = TRUE)
f = system.file(package = "rangeMapper", "extdata", "wrens", "vector_combined")
global.bbox.save(con = dbcon, bbox = f) 
gridSize.save(dbcon, gridSize = 3) 
canvas.save(dbcon) 
data(wrens)
bio.save(con = dbcon, loc = wrens ,  ID = "sci_name")
r = readOGR(f, "wrens", verbose = FALSE)
processRanges(spdf = r, con =  dbcon, ID = "sci_name")
rangeMap.save(dbcon)

sr = rangeMap.fetch(dbcon)
image(sr, axes = TRUE); grid()

p = list(x = -76.39, y = 9.26)
# or use locator:  p =  locator(1) 

xy = SpatialPoints( do.call(cbind, p), proj4string = CRS("+proj=longlat +datum=NAD83 +no_defs ") )
af = assemblageFetch(rangeMap(projLoc) , xy)
points(p, col = 4, cex = 2)
print(af)

af = assemblageFetch(rangeMap(projLoc) , xy, "wrens")
print(af[, c(1, 4, 6:8)])

Run the code above in your browser using DataLab