ST_LocateBetweenElevations

更新时间:
复制 MD 格式

Returns the portions of a geometry that fall within a specified elevation (Z) range.

Syntax

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

Parameters

ParameterDescription
geomMlineThe input geometry to filter by elevation.
elevationStartThe lower bound of the elevation range.
elevationEndThe upper bound of the elevation range.

Description

ST_LocateBetweenElevations returns a geometry collection containing only the parts of the input geometry whose Z values fall within the specified elevation range. The function supports 3D objects and Z coordinates are preserved in the output.

Examples

Example 1: Filter a MultiPoint by elevation range

Points with Z values outside the range are excluded from the result.

SELECT ST_AsText(
  ST_LocateBetweenElevations(
    ST_GeomFromText('MultiPoint((1 2 3),(4 5 6),(7 8 9))'), 3, 6));

Result:

         st_astext
----------------------------
 MULTIPOINT Z (1 2 3,4 5 6)
(1 row)