
Column-Slim Heavy Layers per the Project's Keep-List Sidecar
Source:R/rfp_project_slim.R
rfp_project_slim.RdDrops attribute columns not listed in the project's column keep-list
sidecar (rfp_manifest_columns.csv, columns source_layer,column).
Keep-list semantics: listed columns are kept (fid + geometry always
kept implicitly); everything else is dropped. Fail-closed by design -
new fat columns arriving upstream don't reach field devices until
deliberately added to the sidecar (rtj#178).
Usage
rfp_project_slim(
path,
sidecar = NULL,
dry_run = TRUE,
path_hold = NULL,
dir_layers = NULL,
file_gpkg = NULL,
layout = NULL
)Arguments
- path
Character. Path to the project directory containing
background_layers.gpkg.- sidecar
NULL(default), a path to a sidecar CSV, or a data frame with columnssource_layer,column.NULLreadsrfp_manifest_columns.csvat the project root.- dry_run
Logical. Default
TRUE- print the plan and exit.- path_hold
Character. Root directory for the pre-slim backup. Default
NULLuses ahold/directory NEXT TO the project (never inside it).- dir_layers
Character. Directory holding one GeoPackage per layer.
NULL(default) resolvesgetOption("rfp.dir_layers").- file_gpkg
Character. Single-GeoPackage file name for projects that have not been split.
NULL(default) resolvesgetOption("rfp.file_gpkg").- layout
Character.
"split","monolith", orNULL(default) to detect from the project directory.
Value
Invisibly, a list with plan (kept columns per layer to slim)
and office (office-companion columns per layer).
Details
Dropped columns are NOT discarded: they're written with join keys
(fid, plus segmented_stream_id / aggregated_crossings_id when
present) to an attribute-only table in
ignore_mobile/background_layers_office.gpkg (rtj#180). Writing the
office companion requires selective sync configured in
mergin-config.json (input-selective-sync: true,
input-selective-sync-dir: "ignore_mobile") - enforced fail-closed on
execute, or the office gpkg (exactly the bytes this tool exists to keep
off devices) would sync to the field.
Note: refresh re-fattens - the source passes re-download all columns, so slim runs after every refresh of a slimmed layer until column selection moves to download time (#12 Phase 3).
DRY-RUN by default; on execute the gpkg is backed up to path_hold,
each layer is rewritten in place (two-hop ogr2ogr via a temp gpkg
with -preserve_fid on both hops so the office rejoin stays valid),
feature counts are verified, and the file is VACUUMed. Push stays
manual, as ever.