[postgis-users] Find LineString segment index containing closest point?

Martin Davis mtnclimb at gmail.com
Tue Aug 4 14:53:05 PDT 2020


And adding a ST_DumpSegments function would help make this (and other uses
cases) simpler as well.

On Tue, Aug 4, 2020 at 2:51 PM Martin Davis <mtnclimb at gmail.com> wrote:

> Good find.  And yes, the only approach currently that seems viable is to
> iterate over the segments in some way and select the closest.
>
> Nowadays using LATERAL JOIN might make this a bit simpler.
>
> On Tue, Aug 4, 2020 at 1:43 PM Bruce Rindahl <bruce.rindahl at gmail.com>
> wrote:
>
>> I found this post from a few years back by Paul Ramsey:
>>
>> http://blog.cleverelephant.ca/2015/02/breaking-linestring-into-segments.html
>>
>> 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?
>> Sorry, I can't test right now as my pgadmin is not working.
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200804/04982bbe/attachment.html>


More information about the postgis-users mailing list