This topic describes the ST_DFullyWithin function. This function checks whether the distance between any two points on two geometry objects is less than a specified distance. If the distance between any two points on the two geometry objects is less than the specified distance, this function returns True. Otherwise, this function returns False.

Syntax

boolean  ST_DFullyWithin(geometry  g1 , geometry  g2 , double precision  distance);

Parameters

Parameter Description
g1 The first geometry object that you want to specify.
g2 The second geometry object that you want to specify.
distance The distance that you want to specify. The distance is measured in the unit that is specified by the spatial reference system of the geometry objects.

Description

  • The two geometry objects that you specify must use the same projection method and have the same spatial reference identifier (SRID).
  • This function automatically compares the bounding boxes of the geometry objects that you specify by using all available indexes on the geometry objects.

Examples

The following example shows the difference between the ST_DFullyWithin function and the ST_DWithin function:
SELECT ST_DFullyWithin(g1,g2,2), ST_DWithin(g1,g2,2) from (SELECT 'LINESTRING(0 1,1 1)'::geometry as g1,
                                                                           'LINESTRING(0 0,0 -1)'::geometry as g2) as test;
 st_dfullywithin | st_dwithin
-----------------+------------
 f               | t
(1 row)