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

Regina Obe lr at pcorp.us
Wed Aug 14 11:20:08 PDT 2019


Okay -- yah I spoke too soon about the ST_Extent and ST_ConvexHull would be a better option.
I had also forgotten that ST_LongestLine takes two inputs, which we are discussing on IRC to add another proto that takes just one input.

So my revised answer is:

WITH c AS (SELECT ST_ConvexHull(ST_Collect(geom)) AS geom FROM your_points)
SELECT ST_LongestLine(c.geom,c.geom);

https://postgis.net/manual-2.5/ST_LongestLine.html


-----Original Message-----
From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of J.J. Green
Sent: Wednesday, August 14, 2019 12:21 PM
To: postgis-users at lists.osgeo.org
Subject: Re: [postgis-users] [Longest distance between two from list of points?]

The two points will be on the boundary of the convex hull of the set of points.  That should reduce the problem to a size where a brute-force cross-join becomes feasible.

-j
_______________________________________________
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