package-points
See docs/reference/README.md for the MUST/SHOULD/MAY convention, and
docs/reference/shared.md for rules package-points shares with other
tools.
Inputs¶
package-pointsMUST read the input and reproject it to EPSG:4326.package-pointsMUST detect every admin level present, either structurally (core.schema_map's cardinality/containment matcher, no naming convention assumed, the default whenname_field/code_fieldare omitted) or via an explicitname_field/code_fieldpair, raisingValueErrorif no level is found.- With auto-detection, a whole-table-constant column family sharing the
detected levels' own naming style (e.g.
adm0_*beside a detectedadm1_*/adm2_*, or a word-anchoredcountry_*besidestate_*/county_*) MUST be treated as its own coarsest level, dissolved to a single row.
Point extraction¶
package-pointsMUST dissolve the input once per detected level, grouping by that level's own code column, then reduce each dissolved unit to a single point viaST_MaximumInscribedCircle(geom).center(the pole of inaccessibility), never the centroid.package-pointsMUST raiseValueErrorif a level's dissolved row count does not equal that level's distinct code-column count in the input, or if any output point is not covered by its own source polygon (ST_Covers).- Every level's points MUST be tagged with a depth column (
adm_lvlby default, overridable viadepth_column), holding that level's own numeric depth.package-pointsMUST raiseValueErrorifdepth_columnalready exists as a column on the input, rather than silently producing a renamed duplicate column. - Every level's own identity columns, including a whole-table-constant
root's, MUST land under one name shared across every level: the source
file's own naming convention (e.g.
pcode,name, derived by stripping each level's own naming anchor), or an explicit schema's fixedcode/name. No level-numbered column (e.g.adm1_pcode) MUST ever appear in the output: an ancestor level's identity columns are excluded from a finer level's own dissolve, the same as any other level's, rather than kept as a repeated, numbered ancestor value.
Outputs¶
package-pointsperforms no topology hard gate; it is a derived cartographic layer, not a coverage layer.package-pointsMUST combine every level's points into one output file. A column that cannot generalize to every level combined into the output (a finer level's own identity column, or an attribute that would only ever beNULLon a coarser level's rows) MUST be excluded from the combined output entirely, never carried through as an always-NULLcolumn; the combine MUST NOT assume a fixed column set across levels.
Configuration (api.package_points.package_points() / CLI)¶
package-pointsMUST process exactly one input file per call.- The output path MUST default to the input path with a
_pointssuffix. package-pointsMUST raiseFileExistsErrorif the output path already exists and overwriting wasn't requested.step, if given, MUST be one ofinputs,points,outputs; any other value MUST raiseValueError.name_field/code_fieldMUST be given together, or both omitted; when both are omitted,package-pointsMUST fall back to full structural auto-detection of every level.