Initiate a geospatial database or register a database that exists at the root path.
adb_init(
root,
version,
author,
licence,
ontology,
gazetteer = NULL,
top = NULL,
staged = TRUE
)
character(1)
path to the root directory that
contains or shall contain an areal database.
character(1)
version identifier for this
areal database.
character(1)
authors that contributed to
building this areal database. Should be a list with items "cre"
(creator), "aut"
(authors) and "ctb"
(contributors).
character(1)
licence (link) for this areal
database.
list(.)
named list with the path(s) of
ontologies, where the list name identifies the variable that shall be
matched with the ontology at the path.
character(1)
path to the gazetteer that
holds the (hierarchical) information of territorial units used in this
database.
character(1)
the label of the class in the
gazetteer that represents the top-most unit (e.g. country) of the areal
database that shall be started.
logical(1)
whether or not the file structure is
arranged according to stages (with geometries and tables separated), or
merely as input/output (of all types).
No return value, called for the side effect of creating the directory structure of the new areal database and tables that contain the database metadata.
This is the first function that is run in a project, as it initiates the areal database by creating the default sub-directories and initial inventory tables. When a database has already been set up, this function is used to register that path in the options of the current R session.
adb_init(root = paste0(tempdir(), "/newDB"),
version = "1.0.0", licence = "CC-BY-0.4",
author = list(cre = "Gordon Freeman", aut = "Alyx Vance", ctb = "The G-Man"),
gazetteer = paste0(tempdir(), "/newDB/territories.rds"),
top = "al1",
ontology = list(var = paste0(tempdir(), "/newDB/ontology.rds")))
#> Warning: no gazetteer was found in the provided path!
#> creating root directory /tmp/RtmpchyebE/newDB
#> creating .../tables
#> creating .../tables/stage1
#> creating .../tables/stage2
#> creating .../tables/stage2/processed
#> creating .../tables/stage3
#> creating .../geometries
#> creating .../geometries/stage1
#> creating .../geometries/stage2
#> creating .../geometries/stage2/processed
#> creating .../geometries/stage3
#> creating .../_meta
#> creating .../_meta/schemas
#> creating .../_meta/documentation
#> creating .../_meta/territories
#> copying gazetteer to .../_meta/territories.rds
#> creating .../_meta/ontology
#> copying ontology to .../_meta/ontology.rds
#> creating .../_meta/inventory.rds
#> creating .../db_info_1.0.0.RData
getOption("adb_path"); getOption("gazetteer_path")
#> [1] "/tmp/RtmpchyebE/newDB"
#> [1] "/tmp/RtmpchyebE/newDB/_meta/territories.rds"