schema-fill
See docs/reference/README.md for the MUST/SHOULD/MAY convention, and
docs/reference/shared.md for rules schema-fill shares with other tools.
Inputs¶
schema-fillMUST read the input and reproject it to EPSG:4326 the same way every other tool does, viacore.io.read_and_reproject().schema-fillMAY take the samename_field/code_fieldpairschema-maptakes (each containing a{n}placeholder); both MUST be given together, or both omitted. When given,schema-fillMUST detect every admin level 1..N present viacode_field's prefix, N being the deepest level column found, and MUST raiseValueErrorif any level in that 1..N range is missing its own code column, or if none is found at all; level 0 is additionally included whenever its own code column is present, without requiring it.- When
name_field/code_fieldare omitted,schema-fillMUST instead structurally auto-detect every admin level and its own code column (core.schema_map's cardinality/containment matcher, no naming convention assumed), raisingValueErrorif any detected level lacks a code column.
Filling¶
schema-fillMUST append one new column, named bydepth_column(--depth-columnon the CLI, defaulting toadm_lvl), stamping each row with the deepest level whose original (pre-fill) code column was non-NULL. This is the only signal distinguishing a genuine leaf-level row from a coarser row whose deeper columns were only ever filled down.schema-fillMUST raiseValueErrorifdepth_columnalready names an existing column on the input.- For each admin-hierarchy column family sharing a level prefix and suffix
(matched independently against
name_field's andcode_field's own prefixes when given, e.g. everyadm{n}_pcode, everyadm{n}_name; or, when auto-detecting, grouped by each level's shared naming anchor, digit or word, prefix or suffix position),schema-fillMUST pin every level past a row's owndepth_columnvalue to the family's own value at that row's real depth (or the nearest shallower level the family itself has a column for), leaving a value at or before a row's own real depth untouched, NULL included. This is a per-row pin: two rows in the same input file at different real depths are each filled relative to their own depth, never a single file-wide level. schema-fillMUST NOT touch geometry, and MUST NOT drop or rename any column other than addingdepth_column.
Outputs¶
schema-fillperforms no topology hard gate at all; it only fills attribute columns and stamps a depth column, never touching geometry.schema-fillMUST export the filled layer to a single output file.
Configuration (api.schema_fill.fill() / CLI)¶
schema-fillMUST process exactly one input file per call.- The output path MUST default to the input path with a
_fillstem suffix. schema-fillMUST raiseFileExistsErrorif the output path already exists and overwriting wasn't requested.step, if given, MUST be one ofinputs,fill,outputs; any other value MUST raiseValueError.schema-fillMAY acceptdepth_column/--depth-column, overriding theadm_lvldefault name for the stamped depth column.