Skip to content

Instantly share code, notes, and snippets.

Last active Sep 29, 2021
What would you like to do?
Sample Along Line with PostGIS
SELECT ST_AsText(ST_LocateAlong(ST_AddMeasure(my_line, 0, ST_Length(my_line)::int), generate_series(0, ST_Length(my_line)::int))) FROM (
SELECT ST_GeomFromText('LINESTRING(-121 47, -80 26)') AS my_line
) q
SELECT ST_AsText(ST_LocateAlong(my_line, generate_series(0, 7))) FROM (SELECT ST_AddMeasure(
ST_GeomFromText('LINESTRING(0 0, 0 7)'), 0, 7
) AS my_line
) q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment