ST_3DDWithin — Перевіряє, чи дві 3D-геометрії знаходяться в межах заданої 3D-відстані
boolean ST_3DDWithin(geometry g1, geometry g2, double precision distance_of_srid);
Повертає значення true, якщо 3D-відстань між двома геометричними значеннями не перевищує відстань distance_of_srid. Відстань вказується в одиницях, визначених просторовою системою координат геометрій. Щоб ця функція мала сенс, вихідні геометрії повинні бути в одній системі координат (мати однаковий SRID).
|
|
|
This function automatically includes a bounding box comparison that makes use of any spatial indexes that are available on the geometries. |
This function supports 3d and will not drop the z-index.
This function supports Polyhedral surfaces.
This method implements the SQL/MM specification. SQL-MM ?
Доступність: 2.0.0
Compare the same transformed point and line in both 3D and 2D. The 3D test fails because the Z difference matters even though the 2D footprints are close enough.
WITH sample AS (
SELECT ST_Transform('SRID=4326;POINT(-72.1235 42.3521 4)'::geometry, 2163) AS input_point,
ST_Transform(
'SRID=4326;LINESTRING(-72.1260 42.45 15,-72.123 42.1546 20)'::geometry,
2163
) AS input_line
)
SELECT ST_3DDWithin(input_point, input_line, 126.8) AS within_dist_3d,
ST_DWithin(input_point, input_line, 126.8) AS within_dist_2d,
input_point AS input_point,
input_line AS input_line
FROM sample;
-[ RECORD 1 ]--+---------------------------------------------------------------------------------------------------------------------------------- within_dist_3d | f within_dist_2d | t input_point | POINT Z (-11774128.9 5237160.2 4) input_line | LINESTRING Z (-11774339.5 5243556.8 15,-11773706.7 5215256.3 20)