ST_LocateBetweenElevations

更新时间:
复制 MD 格式

Returns a geometry collection containing only the parts of the input geometry whose elevation (Z value) falls within the specified range.

Syntax

geometry ST_LocateBetweenElevations(geometry geomMline, float8 elevationStart, float8 elevationEnd);

Description

ST_LocateBetweenElevations filters the components of a 3D geometry by elevation range. Only components whose Z coordinate is between elevationStart and elevationEnd are included in the result. Z coordinates are preserved in the output — the function does not strip the third dimension from returned geometries.

Parameters

ParameterTypeDescription
geomMlinegeometryThe input geometry to filter.
elevationStartfloat8The minimum elevation.
elevationEndfloat8The maximum elevation.

Examples

The following example filters a MULTIPOINT Z geometry, returning only the points whose Z value falls between 3 and 6. The point (7 8 9) is excluded because its Z value of 9 exceeds the upper bound.

SELECT ST_AsText(ST_LocateBetweenElevations(ST_GeomFromText('MultiPoint((1 2 3),(4 5 6),(7 8 9))'),3,6));
         st_astext
----------------------------
 MULTIPOINT Z (1 2 3,4 5 6)
(1 row)