Skip to content
🎉 Apache Sedona 1.8.1 is now available! Check out the new features and improvements.

ST_WeightedDistanceBandColumn

Introduction: Introduction: 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.

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

Since: v1.7.1

SQL Example

ST_WeightedDistanceBandColumn(geometry, 1.0, -1.0, true, true, 1.0, false, struct(id, geometry))

Output:

[{{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}]