ST_3DDFullyWithin — Tests if two 3D geometries are entirely within a given 3D distance
boolean ST_3DDFullyWithin(geometry
g1, geometry
g2, double precision
distance);
Returns true if the 3D geometries are fully within the specified distance of one another. The distance is specified in units defined by the spatial reference system of the geometries. For this function to make sense, the source geometries must both be of the same coordinate projection, having the same SRID.
|
|
|
This function automatically includes a bounding box comparison that makes use of any spatial indexes that are available on the geometries. |
Availability: 2.0.0
This function supports 3d and will not drop the z-index.
This function supports Polyhedral surfaces.
This example compares distance-within predicates in 2D and 3D. The point is distance-within the line in 3D, but the full 3D line is not within the same distance of the point.
WITH data AS (
SELECT
'POINT(1 1 2)'::geometry AS geom_a,
'LINESTRING(1 5 2,2 7 20,1 9 100,14 12 3)'::geometry AS geom_b
)
SELECT
ST_3DDFullyWithin(geom_a, geom_b, 10) AS d3dfullywithin10,
ST_3DDWithin(geom_a, geom_b, 10) AS d3dwithin10,
ST_DFullyWithin(geom_a, geom_b, 20) AS d2dfullywithin20,
ST_3DDFullyWithin(geom_a, geom_b, 20) AS d3dfullywithin20
FROM data;
d3dfullywithin10 | d3dwithin10 | d2dfullywithin20 | d3dfullywithin20 ------------------+-------------+------------------+------------------ f | t | t | f