# WL#14161: ST_LineInterpolatePoints

This WL implements a new function, ST_LineInterpolatePoints(*linestring*, *fractional_distance*), that takes a linestring and a fractional distance in the range [0.0, 1.0] and returns the multipoint consisting of points along that linestring at that distance from the starting point or previous point (i.e., a set of points along the linestring at that distance).

The function is implemented for linestrings in all spatial reference systems, both Cartesian and geographic.

Example use case: ST_LineInterpolatePoints is used to find points along a line, e.g., along a road or along a recording av a GPS tracked vehicle. At which points can we say the user has traveled 10%, 20%, etc. of the way: ST_LineInterpolatePoints(<linestring>, 0.1).

- F-1
- The function MUST return NULL if any of its arguments are NULL.
- F-2
- If the geometry argument is not a syntactically well-formed geometry, the function MUST raise ER_GIS_INVALID_DATA during function evaluation.
- F-3
- If the geometry argument is a syntactically well-formed geometry in an undefined SRS, the function MUST raise ER_SRS_NOT_FOUND during function evaluation.
- F-4
- If the geometry argument is a syntactically well-formed geometry but not a linestring, the function MUST raise ER_UNEXPECTED_GEOMETRY_TYPE during function evaluation.
- F-5
- If the geometry argument is a geometry in a geographic SRS and a longitude value is not in the range (-180,180] (in degrees -- other limits in other units), the function MUST raise ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE. (*)
- F-6
- If the geometry argument is a geometry in a geographic SRS and a latitude value is not in the range [-90,90] (in degrees -- other limits in other units), the function MUST raise ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE. (*)
- F-7
- If the fractional distance parameter is outside the range [0.0, 1.0], the function MUST raise ER_DATA_OUT_OF_RANGE during function evaluation.
- F-8
- If the geometry argument is a syntactically well-formed linestring and the fractional distance parameter is within the range (0.0, 1.0], the function MUST return a multipoint containing all point at that distance from the starting point of the linestring or from the previous returned point, measured in fraction of the total length of the linestring. The distance is measured along the linestring. The points MUST be in order of increasing distance from the start point. (E.g., distance 0.1 means return points at distances 0.1, 0.2, ... 1.0 from the start. The point at distance 0.0 is not returned.)
- F-9
- If the geometry argument is a syntactically well-formed linestring and the fractional distance parameter is 0.0, the function MUST return a multipoint containing the starting point.
- F-10
- If the geometry argument is a syntactically well-formed linestring in a geographic SRS and the fractional_distance divides 1 with zero remainder then the result may not contain the last point of the linestring as expected. It may either contain a point close to it or no point that corresponds to fractional_distance 1 due to numerical inaccuracies in the computation.
- F-11
- The return type of the function MUST be MULTIPOINT.

(*) The exact limits will deviate slightly because of floating point arithmetics.

- I-1
- The syntax of interface SQL01 is extended with function ST_LineInterpolatePoints(
*linestring*,*fractional_length*). - I-2
- No new errors.
- I-3
- No new warnings.