ST_LineInterpolatePoints
What is ST_LineInterpolatePoints?
ST_LineInterpolatePoints is a PostGIS function that returns a MULTIPOINT containing points placed at regular fractional intervals along a linestring.
1ST_LineInterpolatePoints(geometry line, float fraction, boolean repeat = true) → geometry
2ST_LineInterpolatePoints(geography gline, float fraction, boolean use_spheroid = true, boolean repeat = true) → geographyfraction is between 0 and 1 and represents the spacing as a fraction of total length. If repeat is false, the function returns only the single point at that fraction, matching ST_LineInterpolatePoint.
When would you use ST_LineInterpolatePoints?
Use it to produce evenly spaced points along a line — mile markers, sampling points for profile analysis, labels along a boundary, or seed points for generating cross-sections. It is much faster than calling ST_LineInterpolatePoint repeatedly.
1SELECT (ST_Dump(ST_LineInterpolatePoints(geom, 0.1))).geom AS pts
2FROM routes
3WHERE id = 1;FAQs
How do I read each point separately?
Wrap the output in ST_Dump to expand the multipoint into a set of single points. You can then LATERAL JOIN or SELECT individual points as rows.
Does the fraction include endpoints?
No — points are placed at fractions fraction, 2*fraction, 3*fraction, ... up to but not exceeding 1.0. The start and end of the line are not automatically included. Add them with ST_StartPoint and ST_EndPoint if you need full coverage.
Can the input be a MultiLineString?
No. The input must be a single LINESTRING. For multi-part lines, either ST_LineMerge to contiguous parts, or iterate with ST_Dump.
Are M values preserved?
Yes — each interpolated point carries interpolated M, which is ideal when the linestring is measure-parameterised (e.g. kilometer-posts) and you want regularly spaced features that retain their measure.