名稱

ST_DFullyWithin — 測試一個幾何物件是否完全在另一個幾何物件的距離範圍內

概要

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

描述

如果 g2 完全在 g1distance 距離內,則返回 true。視覺上,如果 g2 包含在 g1distance 緩衝區內,則條件為 true。距離單位由幾何物件的空間參考系統定義。

[Note]

此函式會自動包含邊界框比較,該比較會利用幾何物件上可用的任何空間索引。

可用性:1.5.0

變更:3.5.0:函式背後的邏輯現在使用緩衝區內的包含性測試,而不是 ST_MaxDistance 演算法。結果將與先前版本不同,但應該更接近使用者的期望。

範例

SELECT
    ST_DFullyWithin(geom_a, geom_b, 10) AS DFullyWithin10,
    ST_DWithin(geom_a, geom_b, 10) AS DWithin10,
    ST_DFullyWithin(geom_a, geom_b, 20) AS DFullyWithin20
FROM (VALUES
    ('POINT(1 1)', 'LINESTRING(1 5, 2 7, 1 9, 14 12)')
    ) AS v(geom_a, geom_b)

 dfullywithin10 | dwithin10 | dfullywithin20
----------------+-----------+----------------
 f              | t         | t