pgh_raster
pghydro : Raster hydrology extension for PgHydro
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 1601 | pgh_raster
|
pghydro
|
6.6 |
GIS
|
GPL-2.0
|
SQL
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
----d--
|
No
|
No
|
No
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Schemas | pgh_raster |
| Requires | plpgsql
postgis
postgis_raster
pghydro
|
| Siblings | pghydro
pgh_hgm
pgh_output
pgh_output_en_au
pgh_output_pt_br
pgh_consistency
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY
|
6.6 |
18
17
16
15
14
|
pghydro |
plpgsql, postgis, postgis_raster, pghydro |
| RPM | PIGSTY
|
6.6 |
18
17
16
15
14
|
pghydro_$v |
postgis36_$v |
| DEB | PIGSTY
|
6.6 |
18
17
16
15
14
|
postgresql-$v-pghydro |
postgresql-$v-postgis-3 |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
el8.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
el9.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
el9.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
el10.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
el10.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
d12.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
d12.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
d13.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
d13.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
u22.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
u22.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
u24.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
u24.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
u26.x86_64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
u26.aarch64
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
PIGSTY 6.6
|
Source
pig build pkg pghydro; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install pghydro; # install via package name, for the active PG version
pig install pgh_raster; # install by extension name, for the current active PG version
pig install pgh_raster -v 18; # install for PG 18
pig install pgh_raster -v 17; # install for PG 17
pig install pgh_raster -v 16; # install for PG 16
pig install pgh_raster -v 15; # install for PG 15
pig install pgh_raster -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pgh_raster CASCADE; -- requires plpgsql, postgis, postgis_raster, pghydroUsage
Sources: PGHydro README, pgh_raster SQL
pgh_raster adds raster-based hydrological products to PgHydro. It stores DEM, flow-path, flow-direction, and flow-accumulation rasters, then exposes functions for upstream/downstream pixel tracing, drainage-area analysis, elevation lookup, elevation profiles, and raster clipping.
Enable
CREATE EXTENSION postgis;
CREATE EXTENSION postgis_raster;
CREATE EXTENSION pghydro;
CREATE EXTENSION pgh_raster;Raster Tables
The extension creates the pgh_raster schema with tables such as:
| Table | Purpose |
|---|---|
pghrt_elevation |
Elevation raster data |
pghrt_flowpath |
Flow-path raster data |
pghrt_flowdirection |
Flow-direction raster data |
pghrt_flowaccumulation |
Flow-accumulation raster data |
Load raster products with PostGIS Raster tooling such as raster2pgsql, using the SRID and tiling scheme that matches the drainage dataset.
Analysis Functions
Function groups include downstream and upstream pixel traversal, upstream area lookup, downstream drainage point and area lookup, elevation pixel values, elevation profiles, and raster clipping.
SELECT nspname, proname
FROM pg_proc p
JOIN pg_namespace n ON n.oid = p.pronamespace
WHERE nspname = 'pgh_raster'
ORDER BY proname;Notes
pgh_raster depends on both pghydro and postgis_raster. Keep raster alignment, SRID, and nodata handling consistent with the vector drainage layers before deriving hydrogeomorphological metrics.