Learn R Programming

arealDB (version 0.3.9)

regGeometry: Register a new geometry entry

Description

This function registers a new geometry of territorial units into the geospatial database.

Usage

regGeometry(
  nation = NULL,
  subset = NULL,
  gSeries = NULL,
  level = NULL,
  layer = NULL,
  nameCol = NULL,
  archive = NULL,
  archiveLink = NULL,
  nextUpdate = NULL,
  updateFrequency = NULL,
  notes = NULL,
  update = FALSE,
  overwrite = FALSE
)

Arguments

nation

[character(1)] either the nation name or the column of the file's attribute table that contains nations.

subset

[character(1)] optional argument to specify which subset the file contains. This could be a subset of territorial units (e.g. only one municipality) or of a target variable.

gSeries

[character(1)] the name of the geometry dataseries (see regDataseries).

level

[integerish(1)] the administrative level at which the geometry is recorded.

layer

[character] the name of the file's layer from which the geometry should be created (if applicable).

nameCol

[character(.)] the columns in which the names of administrative units are to be found, delimited by "|"; see Examples.

archive

[character(1)] the original file (perhaps a *.zip) from which the geometry emerges.

archiveLink

[character(1)] download-link of the archive.

nextUpdate

[character(1)] value describing the next anticipated update of this dataset (in YYYY-MM-DD format).

updateFrequency

[character(1)] value describing the frequency with which the dataset is updated, according to the ISO 19115 Codelist, MD_MaintenanceFrequencyCode. Possible values are: 'continual', 'daily', 'weekly', 'fortnightly', 'quarterly', 'biannually', 'annually', 'asNeeded', 'irregular', 'notPlanned', 'unknown', 'periodic', 'semimonthly', 'biennially'.

notes

[character(1)] optional notes that are assigned to all features of this geometry.

update

[logical(1)] whether or not the file 'inv_geometries.csv' should be updated.

overwrite

[logical(1)] whether or not the geometry to register shall overwrite a potentially already existing older version.

Value

Returns a tibble of the entry that is appended to 'inv_geometries.csv' in case update = TRUE.

Details

When processing geometries to which areal data shall be linked, carry out the following steps:

  1. Determine the nation, a subset (if applicable), the dataseries of the geometry and the administrative level, and provide them as arguments to this function.

  2. Run the function.

  3. Export the shapefile with the following properties:

    • Format: GeoPackage

    • File name: What is provided as message by this function

    • CRS: EPSG:4326 - WGS 84

    • make sure that 'all fields are exported'

  4. Confirm that you have saved the file.

Examples

Run this code
# NOT RUN {
# build the example database
makeExampleDB(until = "regDataseries")

# The GADM dataset comes as *.zip archive
regGeometry(nation = "NAME_0",
            gSeries = "gadm",
            level = 1,
            layer = "example_geom1",
            nameCol = "NAME_0",
            archive = "example_geom.7z|example_geom1.gpkg",
            archiveLink = "https://gadm.org/",
            nextUpdate = "2019-10-01",
            updateFrequency = "quarterly",
            update = TRUE)

# The second administrative level in GADM contains names in the columns
# NAME_0 and NAME_1
regGeometry(nation = "NAME_0",
            gSeries = "gadm",
            level = 2,
            layer = "example_geom2",
            nameCol = "NAME_0|NAME_1",
            archive = "example_geom.7z|example_geom2.gpkg",
            archiveLink = "https://gadm.org/",
            nextUpdate = "2019-10-01",
            updateFrequency = "quarterly",
            update = TRUE)
# }

Run the code above in your browser using DataLab