normGeometry | R Documentation |
Harmonise and integrate geometries into a standardised format
normGeometry(
input = NULL,
pattern = NULL,
query = NULL,
thresh = 10,
beep = NULL,
simplify = FALSE,
stringdist = TRUE,
strictMatch = FALSE,
verbose = FALSE
)
input |
|
pattern |
|
query |
|
thresh |
|
beep |
|
simplify |
|
stringdist |
|
strictMatch |
|
verbose |
|
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 dName match, copy gazID from the geometries they overlap.
For all units that dName not match, rebuild metadata and a new gazID.
store the processed geometry at stage three.
Move the geometry to the folder '/processed', if it is fully processed.
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.
Other normalise functions:
normTable()
if(dev.interactive()){
library(sf)
# build the example database
adb_example(until = "regGeometry", path = tempdir())
# normalise all geometries ...
normGeometry(pattern = "estonia")
# ... and check the result
st_layers(paste0(tempdir(), "/geometries/stage3/Estonia.gpkg"))
output <- st_read(paste0(tempdir(), "/geometries/stage3/Estonia.gpkg"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.