Computes the water depth at each pixel of an area based on a digital elevation model (DEM) and a precipitation volume.
Syntax
float8[] ST_Overflow(raster rast, Box box, float8 value);Parameters
| Parameter | Type | Description |
|---|---|---|
rast | raster | The DEM raster. Must be a single-band raster. |
box | Box | The bounding box of the area to analyze. Must use the same coordinate space as the DEM. |
value | float8 | The total precipitation volume for the area, in cubic meters. |
Description
ST_Overflow computes the water depth in an area based on the geographic coordinates and precipitation of the area. The function returns a float8[] array where each element is the computed water depth at the corresponding DEM pixel.
Pixels with no water accumulation return 0.
Usage notes
The raster (
rast) must be a single-band DEM. Multi-band rasters are not supported.The bounding box (
box) must use the same coordinate space as the DEM.The
valueparameter represents the total precipitation volume for the entire area, not a per-pixel rate.
Example
The following example computes water depths for a DEM tile stored in the t_overflow table, using a precipitation volume of 10,000 cubic meters.
SELECT st_overflow(
rast,
'((-195516.0,2230052.0),(-194626.0,2230942.0))'::box,
10000::float8
)
FROM t_overflow
WHERE id = 1;The function returns a float8[] array. Each element is the water depth at one DEM pixel. A value of 0 means no water accumulated at that pixel.
Example output (truncated):
{0,0,0,...,1.43427103409668,...,0.434271034096678,...,0}