All Products
Search
Document Center

PolarDB:ST_LineInterpolatePoints

Last Updated:Mar 28, 2026

Interpolates a point at one or more specified locations of a LineString object and returns the points.

Syntax

geometry  ST_LineInterpolatePoints(geometry  aLinestring, float8  aFraction, boolean  repeat);
geography ST_LineInterpolatePoints(geography aLinestring, float8  aFraction, boolean  repeat);

Parameters

ParameterTypeDescription
aLinestringgeometry / geographyThe LineString to interpolate along.
aFractionfloat8The fraction based on which the point is interpolated into the line. Valid values: floating-point numbers in the range 0 to 1.
repeatbooleanSpecifies whether to generate points at every interval along the line. Default value: true. When set to false, at most one point is returned.

Usage notes

  • When repeat is true, the function places a point at every location that is represented as a fraction along the line.

  • If the result contains zero or one point, the return type is Point. If the result contains more than one point, the return type is MultiPoint.

  • 3D geometries are supported. Z coordinates are preserved in the output.

  • M coordinates are supported.

  • For the geography overload, distances are calculated using spherical distance rather than planar distance.

Examples

Interpolate points every 20% along a line (geometry)

SELECT ST_AsText(ST_LineInterpolatePoints('LINESTRING(0 0,0 5)', 0.20));

Result:

 MULTIPOINT(0 1,0 2,0 3,0 4,0 5)
(1 row)

Interpolate points every 20% along a line (geography)

SELECT ST_AsText(ST_LineInterpolatePoints('LINESTRING(0 0,0 5)'::geography, 0.20));

Result:

 MULTIPOINT((0 1.00002443285827),(0 2.00004274948544),(0 3.00004884128919),(0 4.00003661494431),(0 5))

Return a single point with repeat set to false (geometry)

SELECT ST_AsText(ST_LineInterpolatePoints('LINESTRING(0 0,0 5)', 0.20, false));

Result:

 POINT(0 1)
(1 row)

Return a single point with repeat set to false (geography)

SELECT ST_AsText(ST_LineInterpolatePoints('LINESTRING(0 0,0 5)'::geography, 0.20, false));

Result:

 POINT(0 1.00002443285827)
(1 row)