All Products
Search
Document Center

ApsaraDB RDS:ST_3DDWithin

Last Updated:Mar 28, 2026

Returns true if the 3D distance between two geometry objects does not exceed the specified threshold. The distance is measured in a projected coordinate system.

Syntax

boolean ST_3DDWithin(geometry g1, geometry g2, double precision distanceOfSrid);

Parameters

ParameterTypeDescription
g1geometryThe first geometry object.
g2geometryThe second geometry object.
distanceOfSriddouble precisionThe maximum distance, measured in the unit defined by the spatial reference system (SRS) of the geometry objects.

Usage notes

  • Supports 3D objects and preserves Z coordinates.

  • Supports polyhedral surfaces.

Examples

Basic usage

Check whether two 3D points are within a distance of 2:

SELECT ST_3DDWithin(
    'POINT(0 0 0)'::geometry,
    'POINT(1 1 1)'::geometry,
    2
);

Output:

 st_3ddwithin
--------------
 t
(1 row)