Name

ST_Contour — Generates a set of vector contours from the provided raster band, using the GDAL contouring algorithm.

Synopsis

setof record ST_Contour(raster rast, integer bandnumber=1, double precision level_interval=100.0, double precision level_base=0.0, double precision[] fixed_levels=ARRAY[], boolean polygonize=false);

Descripción

Generates a set of vector contours from the provided raster band, using the GDAL contouring algorithm.

When the fixed_levels parameter is a non-empty array, the level_interval and level_base parameters are ignored.

Input parameters are:

rast

The raster to generate the contour of

bandnumber

The band to generate the contour of

level_interval

The elevation interval between contours generated

level_base

The "base" relative to which contour intervals are applied, this is normally zero, but could be different. To generate 10m contours at 5, 15, 25, ... the LEVEL_BASE would be 5.

fixed_levels

The elevation interval between contours generated

polygonize

If true, contour polygons will be created, rather than polygon lines.

Return values are a set of records with the following attributes:

geom

The geometry of the contour line.

id

A unique identifier given to the contour line by GDAL.

value

The raster value the line represents. For an elevation DEM input, this would be the elevation of the output contour.

Availability: 3.2.0

Ejemplo

WITH c AS (
SELECT (ST_Contour(rast, 1, fixed_levels => ARRAY[100.0, 200.0, 300.0])).*
FROM dem_grid WHERE rid = 1
)
SELECT st_astext(geom), id, value
FROM c;

Ver también

ST_InterpolateRaster