normGeometry {arealDB} | R Documentation |
Normalise geometries
Description
Harmonise and integrate geometries into a standardised format
Usage
normGeometry(
input = NULL,
pattern = NULL,
query = NULL,
thresh = 10,
outType = "gpkg",
priority = "ontology",
beep = NULL,
simplify = FALSE,
update = FALSE,
verbose = FALSE
)
Arguments
input |
[ |
pattern |
[ |
query |
[ |
thresh |
[ |
outType |
[ |
priority |
[
|
beep |
[ |
simplify |
[ |
update |
[ |
verbose |
[ |
Details
To normalise geometries, this function proceeds as follows:
Read in
input
and extract initial metadata from the file name.In case filters are set, the new geometry is filtered by those.
The territorial names are matched with the gazetteer to harmonise new territorial names (at this step, the function might ask the user to edit the file 'matching.csv' to align new names with already harmonised names).
Loop through every nation potentially included in the file that shall be processed and carry out the following steps:
In case the geometries are provided as a list of simple feature POLYGONS, they are dissolved into a single MULTIPOLYGON per main polygon.
In case the nation to which a geometry belongs has not yet been created at stage three, the following steps are carried out:
Store the current geometry as basis of the respective level (the user needs to make sure that all following levels of the same dataseries are perfectly nested into those parent territories, for example by using the GADM dataset)
In case the nation to which the geometry belongs has already been created, the following steps are carried out:
Check whether the new geometries have the same coordinate reference system as the already existing database and re-project the new geometries if this is not the case.
Check whether all new geometries are already exactly matched spatially and stop if that is the case.
-
Check whether the new geometries are all within the already defined parents, and save those that are not as a new geometry.
Calculate spatial overlap and distinguish the geometries into those that overlap with more and those with less than
thresh
.For all units that did match, copy gazID from the geometries they overlap.
For all units that did not match, rebuild metadata and a new gazID.
If update = TRUE, store the processed geometry at stage three.
Move the geometry to the folder '/processed', if it is fully processed.
Value
This function harmonises and integrates so far unprocessed geometries at stage two into stage three of the geospatial database. It produces for each main polygon (e.g. nation) in the registered geometries a spatial file of the specified file-type.
See Also
Other normalise functions:
normTable()
Examples
if(dev.interactive()){
library(sf)
# build the example database
makeExampleDB(until = "regGeometry", path = tempdir())
# normalise all geometries ...
normGeometry(nation = "estonia", update = TRUE)
# ... and check the result
st_layers(paste0(tempdir(), "/adb_geometries/stage3/Estonia.gpkg"))
output <- st_read(paste0(tempdir(), "/adb_geometries/stage3/Estonia.gpkg"))
}