[GIS] Getting points along line at defined distance using PostGIS

postgis

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.

Best Answer

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 
FROM (
    SELECT ST_DumpPoints(
        ST_Segmentize(
            ST_GeomFromText('LINESTRING(1 30, 15 30)',28992),
            -- this is the defined distance  
            1
        )
   ) AS dp
) AS foo