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

ST_BinaryDistanceBandColumn

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 binary distance band function, weights of neighbors within the threshold will always be 1.0.

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

Since: v1.7.1

SQL Example

ST_BinaryDistanceBandColumn(geometry, 1.0, true, true, false, struct(id, geometry))

Output:

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