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 distance weighted distance band, weights will be distance^alpha.

Signatures

ST_WeightedDistanceBandColumn(geometry:Geometry, threshold: Double, alpha: Double, includeZeroDistanceNeighbors: boolean, includeSelf: boolean, selfWeight: Double, useSpheroid: boolean, attributes: Struct)

Parameters

geometry
Geometry
required
The input geometry.
threshold
Double
required
The maximum distance threshold for including neighbors.
alpha
Double
required
The exponent applied to the distance for weight calculation (weight = distance^alpha).
includeZeroDistanceNeighbors
Boolean
required
Whether to include neighbors at zero distance.
includeSelf
Boolean
required
Whether to include the record itself as its own neighbor.
selfWeight
Double
required
The weight value to assign when the record is 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_WeightedDistanceBandColumn(geometry, 1.0, -1.0, true, true, 1.0, false, struct(id, geometry))
{% raw %}
[{{15, POINT (3 1.9)}, 1.0}, {{16, POINT (3 2)}, 9.999999999999991}, {{17, POINT (3 2.1)}, 4.999999999999996}, {{18, POINT (3 2.2)}, 3.3333333333333304}]
{% endraw %}