ST_filterBetween

更新时间:
复制 MD 格式

Filters the pcpoint objects in a pcpatch by an attribute dimension range and returns a new pcpatch containing only the points whose dimension value falls strictly between the specified minimum and maximum.

Syntax

pcpatch ST_FilterBetween(pcpatch pc, text dimname, float8 minvalue, float8 maxvalue);

Parameters

ParameterDescription
pcThe pcpatch object to filter.
dimnameThe name of the attribute dimension to filter on.
minvalueThe lower bound of the range (exclusive).
maxvalueThe upper bound of the range (exclusive).

Usage notes

The filter uses exclusive bounds: pcpoint objects whose dimension value equals minvalue or maxvalue are excluded from the result. Only points with values strictly between the two bounds are returned.

Example

The following query filters points from the patch with id = 7, returning only those whose y dimension value is strictly between 45.57 and 45.60. Points with y = 45.57 or y = 45.60 are excluded.

SELECT ST_AsText(ST_FilterBetween(pa, 'y', 45.57, 45.60)) FROM patches WHERE id = 7;

Output:

{"pcid":1,"pts":[[-126.42,45.58,58,5],[-126.41,45.59,59,5]]}

The result contains two points with y = 45.58 and y = 45.59, confirming that the bounds are exclusive.