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.
Signatures
Parameters
Geometry
required
The left geometry value.
Geometry
required
The right geometry value.
Double
required
The distance value.
Boolean
Whether to use spheroidal distance calculation. Defaults to
false.Return type
Returns
true or false.
