<div dir="ltr">I found this post from a few years back by Paul Ramsey:<br><a href="http://blog.cleverelephant.ca/2015/02/breaking-linestring-into-segments.html">http://blog.cleverelephant.ca/2015/02/breaking-linestring-into-segments.html</a> <div>One of the examples gives a collection of each segment of the line along with what you can use as an index.  Could you then query for the closest geometry from that collection and get the index number? <br></div><div>Sorry, I can't test right now as my pgadmin is not working.</div></div>