rmap_prepare | R Documentation |
rmap_prepare
updates a 'raw' unprepared project to a ready to use project.
rmap_prepare
creates the project's canvas and assign each range to its corresponding canvas cells by
performing a spatial intersection between the ranges and the canvas. The canvas is a regular grid
of squares or hexagons.
rmap_prepare(con, grid_type, cellsize, chunksize, ...) ## S4 method for signature 'rmapConnection,character,numeric,missing' rmap_prepare(con, grid_type, cellsize, chunksize, ...) ## S4 method for signature 'rmapConnection,character,numeric,numeric' rmap_prepare(con, grid_type = "hex", cellsize, chunksize = 1/10, ...)
con |
a |
grid_type |
character "hex" (default) or "square", see |
cellsize |
target cellsize, see |
chunksize |
parallel processing chunk size expressed as proportion from the range size. Default to 1/10. |
... |
further arguments passed to |
Because rmap_prepare
can be potentially time consuming it can be run in parallel using the
support provided by the future
package.
future
allows parallel processing on a variety of systems including high performance computing environments.
For details see future::plan()
.
Additionally, you can keep track of of the computations using progressr::handlers()
.
TRUE when the table is written to the project file, FALSE otherwise.
Birch, C. P., Oom, S. P., & Beecham, J. A. (2007). Rectangular and hexagonal grids used for observation, experiment and simulation in ecology. Ecological modelling, 206(3-4), 347-359.
rmap_add_ranges()
# IN-MEMORY PROJECT require(rangeMapper) wrens = read_wrens() con = rmap_connect() rmap_add_ranges(con, wrens, 'sci_name') rmap_prepare(con, 'hex', cellsize=500) dbDisconnect(con) ## Not run: # PROJECT PREPARED IN PARALLEL require(future) require(progressr) plan(multisession, workers = 2) handlers(global = TRUE) Path = tempfile() con = rmap_connect(Path) rmap_add_ranges(con, wrens, 'sci_name') rmap_prepare(con, 'hex', cellsize=200, chunksize = 0.1) dbDisconnect(con) plan(sequential) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.