hms2cng — HMS to Cloud Native GIS
Full project access and archival for HEC-HMS. Exports geometry, simulation results, and project metadata to cloud-native GeoParquet — enabling cross-project DuckDB analytics, PMTiles web visualization, and PostGIS integration.
Documentation: rascommander.info/hms2cng
Built on top of hms-commander by CLB Engineering Corporation.
Installation
# Base installation (GeoParquet export only)
pip install hms2cng
# All features (DuckDB, PostGIS, PMTiles)
pip install "hms2cng[all]"
PMTiles Generation
Vector PMTiles are built in-process by freestiler,
installed with hms2cng, so no external tools are needed. To use tippecanoe instead
(and for .mbtiles output), set HMS2CNG_VECTOR_TILER=tippecanoe and install:
- tippecanoe —
conda install -c conda-forge tippecanoe - pmtiles —
go install github.com/protomaps/go-pmtiles/pmtiles@latest
Tiles span zoom 0-14 unless --min-zoom/--max-zoom are given, and no features are
dropped to cap tile size.
Quick Start
Full Project Export
Export an entire HMS project — all basin models, all runs, all layers:
# Preview the project structure (runs, basin models, met models)
hms2cng manifest MyProject.hms
# Export everything to a hierarchical GeoParquet archive
hms2cng project MyProject.hms out/my_archive/
Output structure:
out/my_archive/
manifest.parquet # project-level metadata (1 row)
run_registry.parquet # basin + met + control lineage per run
basin_inventory.parquet # element counts per basin model
geometry/
{basin_slug}/
subbasins.parquet
reaches.parquet
junctions.parquet
...
results/
{run_slug}/
outflow.parquet # peak, min, mean, time of peak
Query across all runs with DuckDB:
import duckdb
df = duckdb.sql("""
SELECT project_name, run_name, name, max_value, units
FROM read_parquet('out/my_archive/results/*/*.parquet', union_by_name=true)
ORDER BY max_value DESC
LIMIT 20
""").df()
Single-Layer Export
# Export a specific geometry layer
hms2cng geometry model.basin subbasins.parquet --layer subbasins
# Export simulation results
hms2cng results project/results results.parquet --type subbasin --var Outflow
# Query with DuckDB
hms2cng query results.parquet "SELECT name, max_value FROM _ ORDER BY max_value DESC"
# Generate PMTiles
hms2cng pmtiles subbasins.parquet subbasins.pmtiles --layer subbasins
# Sync to PostGIS
hms2cng sync subbasins.parquet "postgresql://user:pass@host:5432/db" hms_subbasins
Python API
from hms2cng import (
export_full_project, # export entire HMS project
get_project_manifest, # read project structure as dict
export_all_basin_geometry, # batch geometry export
export_all_results, # batch results export
export_basin_geometry, # single layer export
export_hms_results, # single run export
DuckSession,
)
# Full project archive
summary = export_full_project("MyProject.hms", "out/archive/")
print(f"Geometry files: {len(summary['geometry_files'])}")
print(f"Results files: {len(summary['results_files'])}")
# Project manifest
manifest = get_project_manifest("MyProject.hms")
print(manifest["run_names"]) # JSON list of run names
# Single layer (original API unchanged)
from hms2cng.geometry import get_basin_layer_gdf
gdf = get_basin_layer_gdf("project.basin", layer="subbasins")
Cloud Native GIS Stack
| Legacy | Cloud Native | Benefit |
|---|---|---|
| Shapefile | GeoParquet | Columnar, Arrow-native, compressed |
| WMS/WFS | PMTiles | Serverless HTTP range requests |
| PostGIS queries | DuckDB | In-process spatial SQL, no server |
| SDE layers | PostGIS | Open standard, cloud-ready |
Development
git clone https://github.com/gpt-cmdr/hms2cng
cd hms2cng
uv pip install -e ".[all]"
# Run tests
uv run pytest tests/
# Interactive examples (marimo)
uv run marimo edit examples/06_full_project_export.py
# Preview docs
uv run mkdocs serve
About CLB Engineering
hms2cng is an open-source project of CLB Engineering Corporation, the creators of hms-commander and ras-commander.
CLB pioneered the LLM Forward approach to civil engineering — a framework where licensed professional engineers leverage Large Language Models to accelerate H&H modeling workflows while maintaining full professional responsibility.
Contact: info@clbengineering.com | Website: clbengineering.com
License
MIT — See LICENSE
Author: William M. Katzenmeyer, P.E., C.F.M. — CLB Engineering Corporation
Metadata
Release files for hms2cng 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hms2cng-0.3.0.tar.gz | 47.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hms2cng-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.2 kB
Release files / hms2cng-0.3.0.tar.gz
| Download URL | hms2cng-0.3.0.tar.gz |
|---|---|
| Size | 47.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48859c6c8a13b63b1c1e73a4e8d12031a07d3ca181a7d6be39173f4b08113f17
|
|
BLAKE2b-256 checksum How to use checksums |
10116d8561d333f2f8069036481eb28cd91b3130a65fda209596ad941b60645b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / hms2cng-0.3.0-py3-none-any.whl
| Download URL | hms2cng-0.3.0-py3-none-any.whl |
|---|---|
| Size | 34.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
736cec8b4d9fb25880d3740183d2d103eac4c2b8258f31d12fd42e34e4517f35
|
|
BLAKE2b-256 checksum How to use checksums |
7095ba03b9718652f7fee2e2609853cacf4b062cd6c292da29eb8d1f2473a674
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for hms2cng 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.