Title: | Create a Sampling Frame Using GRTS |
---|---|
Description: | Create an SQLite database containing the sampling framework for different levels of resolution. Take a sample from this framework. |
Authors: | Thierry Onkelinx [aut, cre] , Bruno De Vos [aut] , Research Institute for Nature and Forest [cph, fnd] |
Maintainer: | Thierry Onkelinx <[email protected]> |
License: | GPL-3 |
Version: | 0.2 |
Built: | 2024-10-29 04:01:54 UTC |
Source: | https://github.com/inbo/grtsdb |
Add legacy sites
add_legacy_sites(legacy, bbox, cellsize, grtsdb = connect_db())
add_legacy_sites(legacy, bbox, cellsize, grtsdb = connect_db())
legacy |
A matrix with coordinates of the legacy sites. One column for every dimension. |
bbox |
A two-column matrix. The first column has the minimum, the second the maximum values. Rows represent the spatial dimensions. |
cellsize |
The size of each cell. Either a single value or one value for each dimension. |
grtsdb |
the grtsdb object |
Other legacy:
drop_legacy_sites()
,
extract_legacy_sample()
Add a level to the grtsdb
add_level(bbox, cellsize, grtsdb = connect_db(), verbose = TRUE, level)
add_level(bbox, cellsize, grtsdb = connect_db(), verbose = TRUE, level)
bbox |
A two-column matrix. The first column has the minimum, the second the maximum values. Rows represent the spatial dimensions. |
cellsize |
The size of each cell. Either a single value or one value for each dimension. |
grtsdb |
the grtsdb object |
verbose |
Display progress |
level |
the required level |
Other base:
connect_db()
,
extract_sample()
,
reexports
Compact the database by removing the lower levels and all indices
compact_db(grtsdb = connect_db())
compact_db(grtsdb = connect_db())
grtsdb |
the grtsdb object |
Other utility:
create_index()
,
has_index()
,
is_grtsdb()
,
n_level()
,
which_level()
connect to or create an SQLite database
connect_db(db = getOption("grtsdb", "grts.sqlite"))
connect_db(db = getOption("grtsdb", "grts.sqlite"))
db |
the name or path of the database |
Other base:
add_level()
,
extract_sample()
,
reexports
Add the index to the table
create_index(level, grtsdb = connect_db(), legacy = FALSE, ...)
create_index(level, grtsdb = connect_db(), legacy = FALSE, ...)
level |
the required level |
grtsdb |
the grtsdb object |
legacy |
Use legacy sites.
Defaults to |
... |
Arguments passed on to
|
Other utility:
compact_db()
,
has_index()
,
is_grtsdb()
,
n_level()
,
which_level()
Drop the table with legacy sites for a given level
drop_legacy_sites(level, grtsdb = connect_db())
drop_legacy_sites(level, grtsdb = connect_db())
level |
the required level |
grtsdb |
the grtsdb object |
Other legacy:
add_legacy_sites()
,
extract_legacy_sample()
Extract the GRTS sample with legacy sites
extract_legacy_sample( grtsdb = connect_db(), samplesize, bbox, cellsize, verbose = TRUE, offset )
extract_legacy_sample( grtsdb = connect_db(), samplesize, bbox, cellsize, verbose = TRUE, offset )
grtsdb |
the grtsdb object |
samplesize |
the required sample size |
bbox |
A two-column matrix. The first column has the minimum, the second the maximum values. Rows represent the spatial dimensions. |
cellsize |
The size of each cell. Either a single value or one value for each dimension. |
verbose |
Display progress |
offset |
An optional number of samples to skip. This is useful in cases where you need extra samples. |
Other legacy:
add_legacy_sites()
,
drop_legacy_sites()
extract the grts sample
extract_sample( grtsdb = connect_db(), samplesize, bbox, cellsize, verbose = TRUE, offset )
extract_sample( grtsdb = connect_db(), samplesize, bbox, cellsize, verbose = TRUE, offset )
grtsdb |
the grtsdb object |
samplesize |
the required sample size |
bbox |
A two-column matrix. The first column has the minimum, the second the maximum values. Rows represent the spatial dimensions. |
cellsize |
The size of each cell. Either a single value or one value for each dimension. |
verbose |
Display progress |
offset |
An optional number of samples to skip. This is useful in cases where you need extra samples. |
Other base:
add_level()
,
connect_db()
,
reexports
has a table the required index
has_index(level, grtsdb = connect_db(), legacy = FALSE, ...)
has_index(level, grtsdb = connect_db(), legacy = FALSE, ...)
level |
the required level |
grtsdb |
the grtsdb object |
legacy |
Use legacy sites.
Defaults to |
... |
Arguments passed on to
|
Other utility:
compact_db()
,
create_index()
,
is_grtsdb()
,
n_level()
,
which_level()
Check is an object is a grtsdb
is_grtsdb(grtsdb = getOption("grtsdb", "grts.sqlite"))
is_grtsdb(grtsdb = getOption("grtsdb", "grts.sqlite"))
grtsdb |
the grtsdb object |
Other utility:
compact_db()
,
create_index()
,
has_index()
,
n_level()
,
which_level()
Calculate the required level based on a bounding box and a cellsize
n_level(bbox, cellsize)
n_level(bbox, cellsize)
bbox |
A two-column matrix. The first column has the minimum, the second the maximum values. Rows represent the spatial dimensions. |
cellsize |
The size of each cell. Either a single value or one value for each dimension. |
the required level to cover the bbox using a grid with cellsize
Other utility:
compact_db()
,
create_index()
,
has_index()
,
is_grtsdb()
,
which_level()
Return a vector of level number which are available in the database
which_level(grtsdb = connect_db())
which_level(grtsdb = connect_db())
grtsdb |
the grtsdb object |
Other utility:
compact_db()
,
create_index()
,
has_index()
,
is_grtsdb()
,
n_level()