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
| Parameter | Description |
|---|---|
geomMline | The input geometry to filter by elevation. |
elevationStart | The lower bound of the elevation range. |
elevationEnd | The 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)该文章对您有帮助吗?