Name

GetFaceByPoint — Find the face-id of a face that intersects a given point

Synopsis

integer GetFaceByPoint(varchar atopology, geometry apoint, float8 tol);

Description

Retrieve the id of a face that intersects a Point.

The function returns an integer (id-face) given a topology, a POINT and a tolerance. If tolerance = 0 then the point has to intersect the face.

If the point doesn't intersect a face, returns 0 (zero).

If use tolerance > 0 and there is more than one face near the point then an exception is thrown.

[Note]

If tolerance = 0, the function uses ST_Intersects otherwise uses ST_DWithin.

Availability: 2.0.0 - requires GEOS >= 3.3.0.

Examples

These examples use edges faces created in AddFace

SELECT topology.GetFaceByPoint('ma_topo',geom, 10) As with1mtol, topology.GetFaceByPoint('ma_topo',geom,0) As withnotol
	FROM ST_GeomFromEWKT('POINT(234604.6 899382.0)') As geom;

	 with1mtol | withnotol
	-----------+-----------
			 1 |         0
SELECT topology.GetFaceByPoint('ma_topo',geom, 1) As nearnode
	FROM ST_GeomFromEWKT('POINT(227591.9 893900.4)') As geom;

-- get error --
ERROR:  Two or more faces found

See Also

AddFace, GetNodeByPoint, GetEdgeByPoint