Package 'grtsdb'

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

Help Index


Add legacy sites

Description

Add legacy sites

Usage

add_legacy_sites(legacy, bbox, cellsize, grtsdb = connect_db())

Arguments

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

See Also

Other legacy: drop_legacy_sites(), extract_legacy_sample()


Add a level to the grtsdb

Description

Add a level to the grtsdb

Usage

add_level(bbox, cellsize, grtsdb = connect_db(), verbose = TRUE, level)

Arguments

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

See Also

Other base: connect_db(), extract_sample(), reexports


Compact the database by removing the lower levels and all indices

Description

Compact the database by removing the lower levels and all indices

Usage

compact_db(grtsdb = connect_db())

Arguments

grtsdb

the grtsdb object

See Also

Other utility: create_index(), has_index(), is_grtsdb(), n_level(), which_level()


connect to or create an SQLite database

Description

connect to or create an SQLite database

Usage

connect_db(db = getOption("grtsdb", "grts.sqlite"))

Arguments

db

the name or path of the database

See Also

Other base: add_level(), extract_sample(), reexports


Add the index to the table

Description

Add the index to the table

Usage

create_index(level, grtsdb = connect_db(), legacy = FALSE, ...)

Arguments

level

the required level

grtsdb

the grtsdb object

legacy

Use legacy sites. Defaults to FALSE.

...

Arguments passed on to add_level

verbose

Display progress

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.

See Also

Other utility: compact_db(), has_index(), is_grtsdb(), n_level(), which_level()


Drop the table with legacy sites for a given level

Description

Drop the table with legacy sites for a given level

Usage

drop_legacy_sites(level, grtsdb = connect_db())

Arguments

level

the required level

grtsdb

the grtsdb object

See Also

Other legacy: add_legacy_sites(), extract_legacy_sample()


Extract the GRTS sample with legacy sites

Description

Extract the GRTS sample with legacy sites

Usage

extract_legacy_sample(
  grtsdb = connect_db(),
  samplesize,
  bbox,
  cellsize,
  verbose = TRUE,
  offset
)

Arguments

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.

See Also

Other legacy: add_legacy_sites(), drop_legacy_sites()


extract the grts sample

Description

extract the grts sample

Usage

extract_sample(
  grtsdb = connect_db(),
  samplesize,
  bbox,
  cellsize,
  verbose = TRUE,
  offset
)

Arguments

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.

See Also

Other base: add_level(), connect_db(), reexports


has a table the required index

Description

has a table the required index

Usage

has_index(level, grtsdb = connect_db(), legacy = FALSE, ...)

Arguments

level

the required level

grtsdb

the grtsdb object

legacy

Use legacy sites. Defaults to FALSE.

...

Arguments passed on to add_level

verbose

Display progress

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.

See Also

Other utility: compact_db(), create_index(), is_grtsdb(), n_level(), which_level()


Check is an object is a grtsdb

Description

Check is an object is a grtsdb

Usage

is_grtsdb(grtsdb = getOption("grtsdb", "grts.sqlite"))

Arguments

grtsdb

the grtsdb object

See Also

Other utility: compact_db(), create_index(), has_index(), n_level(), which_level()


Calculate the required level based on a bounding box and a cellsize

Description

Calculate the required level based on a bounding box and a cellsize

Usage

n_level(bbox, cellsize)

Arguments

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.

Value

the required level to cover the bbox using a grid with cellsize

See Also

Other utility: compact_db(), create_index(), has_index(), is_grtsdb(), which_level()


Return a vector of level number which are available in the database

Description

Return a vector of level number which are available in the database

Usage

which_level(grtsdb = connect_db())

Arguments

grtsdb

the grtsdb object

See Also

Other utility: compact_db(), create_index(), has_index(), is_grtsdb(), n_level()