ST_InterpolatePoint

更新时间:
复制 MD 格式

Returns the m coordinate of the location on a LineString closest to a given point.

Syntax

float8 ST_InterpolatePoint(geometry line, geometry point);

Parameters

ParameterDescription
lineThe LineString geometry with M values.
pointThe 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)