Skip to content

Instantly share code, notes, and snippets.

@jczaplew
Last active September 29, 2021 08:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jczaplew/a3b5e7f5ed292a4f0f62 to your computer and use it in GitHub Desktop.
Save jczaplew/a3b5e7f5ed292a4f0f62 to your computer and use it in GitHub Desktop.
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