ST_Project_Point — Finds the closest point from a Line to a given point
geometry ST_Project_Point(bytea Line, bytea Point);
Finds the closest point from a Line to a given point.
![]() | |
ST_Project_Point (Line, Point) is a shortening of ST_Line_Interpolate_Point(line,ST_Line_Locate_Point(line,point)) |
| 2D | 3D | M |
|---|---|---|
![]() | ![]() | ![]() |
| OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
|---|---|---|---|
| - | - | - | - |
SELECT ST_AsText(ST_Project_Point(line,point)) as interpolate
FROM (SELECT ST_GeomFromText('LINESTRING (10 11, 15 26, 29 35)') as line,
ST_GeomFromText('POINT (27 27)') as point) as foo;
--Result
interpolate
-----------------------------------------------
POINT (23.945848375451263 31.750902527075812)
(1 row)