ST_LineLocatePoint
返回介于0和1之间的浮点数,表示LineString上与给定Point点最接近的点在其总长度的位置。
语法
float8 ST_LineLocatePoint(geometry aLinestring , geometry aPoint);
float8 ST_LineLocatePoint(geography aLinestring , geography aPoint);
参数
参数名称 | 描述 |
aLinestring | 目标LineString对象。 |
aPoint | 目标Point对象。 |
描述
该函数在估算地址数量时很有用。
示例
SELECT ST_LineLocatePoint('LINESTRING(0 0,0 2)'::geometry, 'POINT(1 1)'::geometry);
st_linelocatepoint
--------------------
0.5
(1 row)
-- geography
SELECT ST_LineLocatePoint('LINESTRING(0 0,0 2)'::geography, 'POINT(1 1)'::geography);
st_linelocatepoint
--------------------
0.5000746195163556
(1 row)