[postgis-users] [Longest distance between two from list of points?]

Nicklas Avén nicklas.aven at jordogskog.no
Wed Aug 14 10:23:47 PDT 2019


On 8/14/19 4:45 PM, Nicklas Avén wrote:
> Hello
>
>
> I am not sure I fully understand what you want, but it sounds like 
> ST_LongestLine could be your friend.
>
>
> Make a collection of the points and handle it to ST_LongestLine and 
> you will get the longest line possible between the points.
>
>
> Something like this:
>
>
> SELECT ST_AsText(ST_LongestLine(col, col)) FROM
> (
>     SELECT ST_Collect(geom) col FROM
>     (
>         VALUES
>         ('point(1 1)'::geometry),
>         ('point(1 2)'::geometry),
>         ('point(2 1)'::geometry),
>         ('point(2 2)'::geometry)
>     ) AS t (geom)
>  ) a
>
>
>
> HTH
>
>
> Nicklas Avén
>
>
>
> On 8/14/19 4:15 PM, Sergiusz Pawlowicz wrote:
>> I have about ten thousands of points stored in a postgis database.
>>
>> I need to find the longest distance between two of the furthest of
>> them from each other, something like bounding box, but let's say
>> "bounding line".
>>
>> Any suggestions?
>>
>> I browse the archives but there was no clearly opensource answer, the
>> only one was suggesting some FME-like commercial products.
>>
>> Thanks,
>> Serge
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/postgis-users


More information about the postgis-users mailing list