Name

ST_3DInterpolatePoint — Returns the interpolated measure of a geometry closest to a point in 3D.

Synopsis

float8 ST_3DInterpolatePoint(geometry linear_geom_with_measure, geometry point);

描述

Returns the interpolated measure value of a linear ZM geometry at the location closest to the given point, using 3D (XYZ) distance for the projection. Use this function when the geometry has significant Z variation, such as flight trajectories, where ST_InterpolatePoint would give incorrect results by ignoring the Z dimension.

[Note]

The line must have both Z and M dimensions. The point should have a Z dimension.

Availability: 3.7.0

该函数支持 3d 并且不会丢失 z-index。

示例

-- Line rising diagonally in Z; point at the 3D midpoint
SELECT ST_3DInterpolatePoint(
    'LINESTRING ZM (0 0 0 0, 10 0 10 20)',
    'POINT Z (5 0 5)');
 ---------------------
         10

-- Vertical line (zero XY extent); 3D projection works where 2D would not
SELECT ST_3DInterpolatePoint(
    'LINESTRING ZM (0 0 0 0, 0 0 10 100)',
    'POINT Z (5 5 5)');
 ---------------------
         50