Returns the m coordinate of the location on a LineString closest to a given point.
Syntax
float8 ST_InterpolatePoint(geometry line, geometry point);Parameters
| Parameter | Description |
|---|---|
line | The LineString geometry with M values. |
point | The reference point to project onto the line. |
Description
ST_InterpolatePoint finds the closest location on line to the given point and returns the interpolated m coordinate at that location.
The function supports 3D geometries and preserves z coordinates.
Example
SELECT ST_InterpolatePoint('LINESTRING M (0 0 0, 2 0 2)', 'POINT(1 1)');Output:
st_interpolatepoint
---------------------
1
(1 row)该文章对您有帮助吗?