ST_3DDWithin — 測試兩個 3D 幾何圖形是否在給定的 3D 距離內
boolean ST_3DDWithin(
geometry g1, geometry g2, double precision distance_of_srid)
;
如果兩個幾何值之間的 3D 距離不超過距離 distance_of_srid
,則返回 true。距離單位由幾何圖形的空間參考系統定義。為了使此函數有意義,源幾何圖形必須在同一坐標系統中(具有相同的 SRID)。
![]() |
|
此函數會自動包含邊界框比較,該比較會利用幾何圖形上可用的任何空間索引。 |
此函數支援 3D,並且不會捨棄 z 索引。
此函數支援多面體表面。
此方法實作 SQL/MM 規範。SQL-MM?
可用性:2.0.0
-- Geometry example - units in meters (SRID: 2163 US National Atlas Equal area) (3D point and line compared 2D point and line) -- Note: currently no vertical datum support so Z is not transformed and assumed to be same units as final. SELECT ST_3DDWithin( ST_Transform(ST_GeomFromEWKT('SRID=4326;POINT(-72.1235 42.3521 4)'),2163), ST_Transform(ST_GeomFromEWKT('SRID=4326;LINESTRING(-72.1260 42.45 15, -72.123 42.1546 20)'),2163), 126.8 ) As within_dist_3d, ST_DWithin( ST_Transform(ST_GeomFromEWKT('SRID=4326;POINT(-72.1235 42.3521 4)'),2163), ST_Transform(ST_GeomFromEWKT('SRID=4326;LINESTRING(-72.1260 42.45 15, -72.123 42.1546 20)'),2163), 126.8 ) As within_dist_2d; within_dist_3d | within_dist_2d ----------------+---------------- f | t