GetNodeByPoint — Finds the node-id of a node at a point location.
integer GetNodeByPoint(
varchar atopology, geometry apoint, float8 tol1)
;
Retrieves the id of a node at a point location.
The function returns an integer (id-node) given a topology, a POINT and a tolerance. If tolerance = 0 means exact intersection, otherwise retrieves the node from an interval.
If apoint
doesn't intersect a node, returns 0 (zero).
If use tolerance > 0 and there is more than one node near the point then an exception is thrown.
이 함수는 tolerance = 0일 경우 ST_Intersects를, 그렇지 않을 경우 ST_DWithin을 이용합니다. |
GEOS 모듈로 실행
2.0.0 버전부터 사용할 수 있습니다.
다음 예시들은 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