This topic describes the ST_LineInterpolatePoints function. This function 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);
Parameters
Parameter | Description |
---|---|
aLinestring | The LineString object that you want to specify. |
aFraction | The fraction based on which the point is interpolated into the line. The value of this parameter is a floating-point number within the range of 0 to 1. |
repeat | Specifies whether to allow the repeated interpolation of the point. Default value: true. |
Description
- If you set the repeat parameter to True, this function interpolates a point at every location that is represented as a fraction along the line.
- If the result is zero or one point, this function returns the result as a point object. Otherwise, this function returns the result as a MultiPoint object.
- This function supports 3D objects and does not delete z coordinates.
- This function supports m coordinates.
Examples
- Interpolate a point by using the default parameter settings.
SELECT ST_AsText(ST_LineInterpolatePoints('LINESTRING(0 0,0 5)', 0.20)); st_astext --------------------------------- MULTIPOINT(0 1,0 2,0 3,0 4,0 5) (1 row)
- Interpolate a point with the repeat parameter set to False.
SELECT ST_AsText(ST_LineInterpolatePoints('LINESTRING(0 0,0 5)', 0.20, false)); st_astext ------------ POINT(0 1) (1 row)