GetEdgeByPoint — Finds the edge-id of an edge that intersects a given point.
integer GetEdgeByPoint(
varchar atopology, geometry apoint, float8 tol1)
;
Retrieves the id of an edge that intersects a Point.
The function returns an integer (id-edge) given a topology, a POINT and a tolerance. If tolerance = 0 then the point has to intersect the edge.
If apoint
doesn't intersect an edge, returns 0 (zero).
If use tolerance > 0 and there is more than one edge near the point then an exception is thrown.
If tolerance = 0, the function uses ST_Intersects otherwise uses ST_DWithin. |
Performed by the GEOS module.
Availability: 2.0.0
These examples use edges we created in 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