Name

GetNodeByPoint — Find the id of a node at a point location

Synopsis

integer GetNodeByPoint(varchar atopology, geometry point, float8 tol);

Retrieve the id of a node at a point location

The function return an integer (id-node) given a topology, a POINT and a tolerance. If tolerance = 0 mean exactly intersection otherwise retrieve the node from an interval.

If there isn't a node at the point, it return 0 (zero).

If use tolerance > 0 and near the point there are more than one node it throw an exception.

[Note]

If tolerance = 0, the function use ST_Intersects otherwise will use ST_DWithin.

Availability: 2.0.0 - requires GEOS >= 3.3.0.

Examples

These examples use edges we created in AddEdge

SELECT topology.GetNodeByPoint('ma_topo',geom, 1) As nearnode 
 FROM ST_GeomFromEWKT('SRID=26986;POINT(227591.9 893900.4)') As geom;
  nearnode
----------
        2
 
SELECT topology.GetNodeByPoint('ma_topo',geom, 1000) As too_much_tolerance
 FROM ST_GeomFromEWKT('SRID=26986;POINT(227591.9 893900.4)') As geom;
 
 ----get error--
 ERROR:  Two or more nodes found
 

See Also

AddEdge, GetEdgeByPoint, GetFaceByPoint