Finalize NextGen output to the Lynker hydrofabric data model spec
Source:R/finalize_data_model.R
finalize_data_model.RdApplies the final column renames, adds VPU/streamorder/slope fields, rolls
up hydrolocation attributes on POIs, and promotes a dedicated
hydrolocations layer. Mutates the provided ngen GeoPackage in place.
See docs/data_model.md for the full mapping against the spec.
Usage
finalize_data_model(
ngen_gpkg,
reference_gpkg = NULL,
vpuid,
events_layer = "pois",
events_gpkg = NULL,
slope_parquet = NULL
)Arguments
- ngen_gpkg
Path to the NextGen GeoPackage produced by
nextgen_from_gpkg+ cleanup steps.- reference_gpkg
Path to the reference fabric (used to source
slopeper member reference COMID). IfNULL, slope staysNA.- vpuid
Single VPU identifier to stamp on every layer (character).
- events_layer
Source layer for hydrolocation attributes. Default
"pois", the pre-ngen pois layer carries the full hl_* set (hl_class, hl_type, hl_source, hl_uri, etc). Theeventslayer in the intermediate gpkg only has a subset, so preferpois.- events_gpkg
Optional: if the hydrolocation source layer isn't in
ngen_gpkg, read it from this gpkg (typically the pre-ngen intermediate).- slope_parquet
Optional path to a parquet of per-reference-id slope used to populate
slope: either a slope table (id,slope_m_per_m) or a channel table (flowpath_id,slope_m_m).NULLleavesslopeNA(default).