I was reading a lot of similar questions here but no one ask about PostGIS (or I didn't find it). I have a line in PostGIS and I want to get the point along the line at defined distance.

Is it possible?

I found st_locate_point but it doesn't work for I want to do.

2 Answers 2


Paolo Corti provides an excellent answer on the postgis mailing list

Use ST_Segmentize and then ST_DumpPoints, like this:

SELECT ST_AsText((dp).geom) As wkt_geom 
    SELECT ST_DumpPoints(
            ST_GeomFromText('LINESTRING(1 30, 15 30)',28992),
            -- this is the defined distance  
   ) AS dp
) AS foo
  • 2
    This will return not only points that were created during ST_Segmentize but points that linestring consisted of already. Commented Apr 5, 2019 at 16:25

Have you tried ST_Line_Interpolate_Point?

Normally it should returns a point interpolated along a line according to the fraction of total length of linestring. The example below shows how it works. You probably need to compute the linestring length before to get the fraction of total length.

--Return point 20% along 2d line
SELECT ST_AsEWKT(ST_Line_Interpolate_Point(the_line, 0.20))
    FROM (
        SELECT ST_GeomFromEWKT('LINESTRING(25 50, 100 125, 150 190)') as the_line)
        AS foo
POINT(51.5974135047432 76.5974135047432)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.