Skip to content

pgh_hgm

Hydrogeomorphological analysis extension for PgHydro

pghydro · Hydrogeomorphological analysis extension for PgHydro

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1602pgh_hgmpghydro2.2.6GISGPL-2.0SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--NoNoNoYesnono
Extension version is 2.2.6, shipped inside pghydro package version 6.6.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY2.2.619 18 17 16 15pghydroplpgsql, postgis, postgis_raster, pghydro, pgh_raster
RPMPIGSTY6.619 18 17 16 15pghydro_$vpostgis37_$v
DEBPIGSTY6.619 18 17 16 15postgresql-$v-pghydropostgresql-$v-postgis-3
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
el8.aarch64N/APIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
el9.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
el9.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
el10.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
el10.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
d12.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
d12.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
d13.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
d13.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
u22.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
u22.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
u24.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
u24.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
u26.x86_64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6
u26.aarch64PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6PIGSTY 6.6

Source

pig build pkg pghydro;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pghydro;		# install by package name
pig install pgh_hgm;		# install by extension name

pig install pgh_hgm -v 19;   # install for PG 19
pig install pgh_hgm -v 18;   # install for PG 18
pig install pgh_hgm -v 17;   # install for PG 17
pig install pgh_hgm -v 16;   # install for PG 16
pig install pgh_hgm -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pgh_hgm CASCADE; -- requires plpgsql, postgis, postgis_raster, pghydro, pgh_raster

Usage

Sources: PGHydro README, pgh_hgm SQL

pgh_hgm adds hydrogeomorphological analysis routines to PgHydro. It combines drainage-line, drainage-area, DEM, and derived raster products to calculate basin and river-network metrics used in water-resources analysis.

Enable

Install it after the core PgHydro and raster extensions:

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_raster;
CREATE EXTENSION pghydro;
CREATE EXTENSION pgh_raster;
CREATE EXTENSION pgh_hgm;

Initialize Objects

The extension creates the pgh_hgm schema with tables such as pghft_drn_elevationprofile, pghft_upn_elevationprofile, and pghft_hydro_intel.

SELECT pgh_hgm.pghfn_tables_initialize();

Metrics

The SQL objects include functions for elevation profiles, drainage-area elevation summaries, average length of overland flow, axis length, circularity, compacity, drainage density, elevation statistics, form factor, hydrodensity, Kirpich time, perimeter, reach gradient, relief ratio, shape factor, time of concentration, slope methods, sinuosity, wave travel, and AMHG depth/width estimates.

SELECT nspname, proname
FROM pg_proc p
JOIN pg_namespace n ON n.oid = p.pronamespace
WHERE nspname = 'pgh_hgm'
ORDER BY proname;

Notes

Load and validate DEM, flow-direction, flow-accumulation, and PgHydro drainage layers before running the metrics. pgh_hgm depends on pgh_raster for raster-derived hydrological products.

Table reader