package
Clean, check and package one input into polygons, points and lines.
Synopsis
Section titled “Synopsis”topo-tools package [OPTIONS] INPUT_FILEDescription
Section titled “Description”Coverage-cleans INPUT_FILE, then runs schema-detect, topo-detect, code-detect and name-detect on it, each writing its own report beside the outputs plus a summary. Any error stops the run before packaging, with exit status 1. Then runs package-polygons, package-points and package-lines on the cleaned layer.
Options
Section titled “Options”--output TEXT: Output path containing “{x}”, replaced by “admin{n}”, “points” or “lines” for each output. Without it, each tool’s default name is used.--name-field TEXT: Name column of each level, with {n} for the level number, e.g. ‘adm{n}_name’. Give it with--code-field. Without both, levels are detected from the data.--code-field TEXT: Code column of each level, with {n} for the level number, e.g. ‘adm{n}_code’. Give it with--name-field. Without both, levels are detected from the data.--output-name-field TEXT: Rename the--name-fieldcolumns to this pattern in every output, e.g. ‘adm{n}_label’. Needs--name-fieldand--code-field.--output-code-field TEXT: Rename the--code-fieldcolumns to this pattern in every output, e.g. ‘adm{n}_pcode’. Needs--name-fieldand--code-field.--aggregation TEXT: How package-polygons combines a column whose values differ inside one unit, as ‘column=function’, where function is sum, min, max, avg or first. By default numbers are summed and other columns dropped. Repeat for more columns.--min-level INTEGER: Lowest admin level to write in every output, e.g. 1 to leave out the admin0 polygons and points, and the outer edges and admin0 borders in lines. Without it, every level is written.--no-clean: Skip the coverage clean and the topology check, writing invalid edges to the package-polygons issues files instead of stopping. For inputs too large to clean, such as a global layer.--no-block: Package even when the schema, topology, code or name checks find errors. The reports are still written.--overwrite BOOLEAN: Replace output files that already exist. Pass--overwrite=falseto stop with an error instead. [default: True]--threads INTEGER: Number of threads DuckDB uses (default: all CPU cores).--debug: Keep intermediate tables, export them to Parquet, and log the time and memory each query takes.--tmp-dir TEXT: Folder for the working DuckDB database and intermediate files (default: a new temporary folder, deleted afterwards unless--debugis set).
Examples
Section titled “Examples”Defaults for all three outputs:
topo-tools package admin3.geojsonChoose where the outputs go:
topo-tools package admin3.geojson --output "web/{x}.geojson"A global layer too large to clean, invalid edges reported instead:
topo-tools package global_admin2.parquet --no-cleanLeave out admin0, e.g. when it comes from another layer:
topo-tools package global_admin2.parquet --min-level 1