Skip to main content
Returns a weights column containing every record in a dataframe within a specified threshold distance. The weights column is an array of structs containing the attributes from each neighbor and that neighbor’s weight. Since this is a binary distance band function, weights of neighbors within the threshold will always be 1.0.

Signatures

ST_BinaryDistanceBandColumn(geometry:Geometry, threshold: Double, includeZeroDistanceNeighbors: boolean, includeSelf: boolean, useSpheroid: boolean, attributes: Struct)

Parameters

geometry
Geometry
required
The input geometry.
threshold
Double
required
The maximum distance threshold for including neighbors.
includeZeroDistanceNeighbors
Boolean
required
Whether to include neighbors at zero distance.
includeSelf
Boolean
required
Whether to include the record itself as its own neighbor.
useSpheroid
Boolean
required
Whether to use spheroidal distance calculation.
attributes
Struct
required
The struct of attribute columns to include from each neighbor.

Return type

A struct containing the result fields.

Examples

ST_BinaryDistanceBandColumn(geometry, 1.0, true, true, false, struct(id, geometry))
{% raw %}
[{{15, POINT (3 1.9)}, 1.0}, {{16, POINT (3 2)}, 1.0}, {{17, POINT (3 2.1)}, 1.0}, {{18, POINT (3 2.2)}, 1.0}]
{% endraw %}