useSpheroid is passed true, ST_DWithin uses Sedona’s ST_DistanceSpheroid to check the spheroid distance between the centroids of two geometries. The unit of the distance in this case is meter.
If useSpheroid is passed false, ST_DWithin uses Euclidean distance and the unit of the distance is the same as the CRS of the geometries. To obtain the correct result, please consider using ST_Transform to put data in an appropriate CRS.
If useSpheroid is not given, it defaults to false
ST_DWithin also accepts two Box2D inputs — ST_DWithin(a: Box2D, b: Box2D, distance: Double) — returning true if the minimum planar (Euclidean) distance between the two rectangles is at most distance. This uses closed-interval semantics, so overlapping or edge/corner-touching boxes have distance 0 and match any non-negative radius. It throws IllegalArgumentException on inverted bounds. Between two Box2D columns the predicate routes through Sedona’s distance-join planner — see Box2D spatial join.
If either geometry is empty, ST_DWithin returns false, with or without useSpheroid.
Signatures
Parameters
Return type
Returns
true or false.
