I try to understand the ST_LocateAlong/ST_LocateBetween PostGIS function. The documentation tells me this:

geometry ST_LocateAlong(geometry ageom_with_measure, float8 a_measure, float8 offset);

Return a derived geometry collection value with elements that match the specified measure. Polygonal elements are not supported.

If an offset is provided, the resultant will be offset to the left or right of the input line by the specified number of units. A positive offset will be to the left, and a negative one to the right.

I understand that a point will be returned if feed in a LineM and a measure. But what is the use of an offset? Will the output point be shifted?

Similar to the offset in ST_LocateBetween - Will the output line substring be shifted? The documentation of ST_LocateBetween does not touch the parameter offset.

I know that I would just have to try it but I am still missing these skills, nevertheless I do need the information.

1 Answer 1


Got the skills faster than expected:

offset parameter with ST_LocateAlong() - Positive offset will move the point left of the line - negative offset will move the point right of the line in map units.

offset parameter with ST_LocateBetween() - Positive offset will move the line left of the line - negative offset will move the line right of the line in map units. This shift of the lines is not a simple shift it works more like a buffer. The end parts have a strange behaviour see picture below. The black line is the original, the red line is the result of ST_LocateBetween() with a given offset.

enter image description here

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.