GetEdgeByPoint — 查找与给定点相交的边的边 ID。
bigint GetEdgeByPoint(varchar atopology, geometry apoint, float8 tol1);
检索与 Point 相交的边的 id。
给定拓扑、POINT 和容差,该函数返回一个整数 (id-edge)。 如果容差 = 0,则该点必须与边相交。
如果apoint与边不相交,返回0。
如果使用的容差(tolerance)大于0,并且在某点附近存在多条边,则会引发异常。
|
|
|
如果tolerance = 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