返回Geometry對象g1之中,離g2最近的2D座標點。
文法
geometry ST_ClosestPoint(geometry g1 , geometry g2);參數
| 參數名稱 | 描述 |
| g1 | 第一個Geometry對象。 |
| g2 | 第二個Geometry對象。 |
描述
返回的是最短線的端點。
樣本
SELECT ST_AsText(ST_ClosestPoint('LINESTRING(0 -1,0 1)'::geometry,'POINT(1 0)'::geometry));
st_astext
------------
POINT(0 0)
(1 row)