Name

GetEdgeByPoint — 查找与给定点相交的边的边ID。

Synopsis

integer GetEdgeByPoint(varchar atopology, geometry apoint, float8 tol1);

描述

检索与点相交的边的ID。

在给定拓扑、点和公差的情况下,该函数返回整数(id-edge)。如果公差=0,则该点必须与边相交。

如果 apoint 不与边相交,返回0(零)。

如果使用公差 >0,并且该点附近有多条边,则会引发异常。

[Note]

如果容差=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

另请参阅

AddEdge, GetNodeByPoint, GetFaceByPoint