GetEdgeByPoint — 尋找與給定點相交的邊緣的邊緣 ID。
integer GetEdgeByPoint(
varchar atopology, geometry apoint, float8 tol1)
;
檢索與點相交的邊緣的 ID。
此函數會根據拓樸、一個點和一個容差,傳回一個整數 (id-edge)。如果容差 = 0,則該點必須與邊緣相交。
如果 apoint
未與邊緣相交,則傳回 0 (零)。
如果使用大於 0 的容差,且在該點附近有多個邊緣,則會擲回例外狀況。
![]() |
|
如果容差 = 0,此函數會使用 ST_Intersects,否則會使用 ST_DWithin。 |
由 GEOS 模組執行。
可用性:2.0.0
這些範例使用我們在 AddEdge 中建立的邊緣
SELECT topology.GetEdgeByPoint('ma_topo',geom, 1) As with1mtol, topology.GetEdgeByPoint('ma_topo',geom,0) As withnotol FROM ST_GeomFromEWKT('SRID=26986;POINT(227622.6 893843)') As geom; with1mtol | withnotol -----------+----------- 2 | 0
SELECT topology.GetEdgeByPoint('ma_topo',geom, 1) As nearnode FROM ST_GeomFromEWKT('SRID=26986;POINT(227591.9 893900.4)') As geom; -- get error -- ERROR: Two or more edges found