ST_Flow_direction

Updated at:

Computes the flow direction of an area using the D8 algorithm applied to digital elevation model (DEM) data.

Syntax

float8[] ST_flow_direction(raster rast, Box box)

Parameters

ParameterDescription
rastThe raster object. Currently must be a single-band DEM.
boxThe world space of the area to analyze.

Description

ST_flow_direction applies the D8 flow direction algorithm to DEM data within the specified area and returns the results as an array of float8 values.

The rast parameter currently must be a single-band raster containing DEM values.

Example

SELECT st_flow_direction(rast, '((-202286.94,2232375.16),(-202135.0,2232225))'::box)
FROM t_overflow
WHERE id = 2;

Output:

                               st_flow_direction
--------------------------------------------------------------------------------
 {2,2,2,4,4,8,2,2,2,4,4,8,1,1,2,4,8,4,128,128,1,2,4,8,2,2,1,4,4,4,1,1,1,1,4,16}
(1 row)