Skip to content

laser-base/unocha

Repository files navigation

unocha

Splits a UNOCHA global admin boundaries geodatabase into per-country GeoPackage files, one file per country per admin level (ADM0–ADM4).

Versions

Version URL notes
0.1.0 https://data.humdata.org/dataset/70f1cb54-a30c-43b2-a751-44e77d8f5ade/resource/733a9d4c-4e70-4f67-a5af-4138922cf43f/download/global_admin_boundaries_matched_latest.gdb.zip provenance.json

Installation

uv pip install .

Requires Python 3.12+.

Usage

unocha [OPTIONS] GDB
Argument / Option Description
GDB Path to the UNOCHA .gdb geodatabase
-o, --output-root PATH Root directory for output (default: ./data or root_dir from config)
--compress / --no-compress Compress each GeoPackage with zstandard after writing (produces .gpkg.zstd, removes .gpkg); compression is on by default
--version Show version and exit
--help Show help and exit

Example

# Write uncompressed GeoPackages under ./data/
unocha global_admin_boundaries_matched_latest.gdb

# Write to a specific directory, compressed
unocha global_admin_boundaries_matched_latest.gdb -o /data/unocha -c

Output

For each admin level 0–4, one GeoPackage per country is written to:

<root>/<ISO3>/UNOCHA-<ISO3>-ADM<level>.gpkg[.zstd]

Each file contains these columns:

Column Description
iso3 ISO 3166-1 alpha-3 country code
adm<level>_name Admin unit name at the output level
adm<level>_pcode Admin unit P-code at the output level
dot_name Colon-separated name path from ADM0 to the output level, e.g. Afghanistan:Badakhshan
geometry MultiPolygon geometry

Configuration

unocha looks for a configuration file in these locations (first found wins):

  1. ./unocha_config.yaml
  2. ./unocha_config.json
  3. ~/.laser/unocha_config.yaml
  4. ~/.laser/unocha_config.json
root_dir: /path/to/output   # default: ./data
log_dir: /path/to/logs      # default: ~/.laser/logs

If no config file is found, defaults are used and a notice is printed.

Logging

Each run writes a timestamped log file to the configured log_dir (default ~/.laser/logs/unocha_YYYYMMDD_HHMMSS.log) at DEBUG level. Console output is WARNING and above only.

About

Snapshot of UNOCHA shapefile data expanded into individual countries and level

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages