Re: [postgis-users] Distance between two furthest points of a group

2015-07-13 Thread Jonathan Moules
To: PostGIS Users Discussion Subject: Re: [postgis-users] Distance between two furthest points of a group Maybe you can even reduce this with cte : with collected_geom AS ( select st_collect(geom) as geoms from your_points ) SELECT ST_LonguestLine(t1.geoms,t2.geoms) FROM collected_geom AS t1

Re: [postgis-users] Distance between two furthest points of a group

2015-06-30 Thread Rémi Cura
Maybe you can even reduce this with cte : with collected_geom AS ( select st_collect(geom) as geoms from your_points ) SELECT ST_LonguestLine(t1.geoms,t2.geoms) FROM collected_geom AS t1, collected_geom AS t2 Cheers, Rémi-C 2015-06-30 8:48 GMT+02:00 Nick Ves vesni...@gmail.com: Didn't know

Re: [postgis-users] Distance between two furthest points of a group

2015-06-30 Thread Nick Ves
Didn't know about st_LongestLine. Just tried and it amazed me! on a dataset of 220k points (on a projected crs) it took ~ 1.5 secs to answer the querry : select 1 as id, ST_LongestLine(st_collect(geom),st_collect(geom)) geom from points ; N On Sat, Jun 27, 2015 at 2:41 PM, Nicklas Avén

Re: [postgis-users] Distance between two furthest points of a group

2015-06-27 Thread Rémi Cura
Maybe I'm wrong, but your 2 farthest points should be on the boundary of the maximum bounding circle (feels right but couldn't prove it). Thus you would compute this circle, then filter points not too far from it, then take the points with the max distance using an inner join (same as Nick, but

Re: [postgis-users] Distance between two furthest points of a group

2015-06-27 Thread Nicklas Avén
Hallo I haven't followed the whole conversation. But one way is to collect alk points and usr ST_maxdistance on the colnections. or st_longestline. longestline will return a line where the end points is the two points furthest from eath other. Those functions is quite fast. /Nicklas Sent

Re: [postgis-users] Distance between two furthest points of a group

2015-06-26 Thread Arnaud Lesauvage
Le 26/06/2015 13:54, Jonathan Moules a écrit : I have sets of points (up to 250,000 in a set) and I want to get the furthest distance between any of them. In theory the simplest way is to use ST_MinimumBoundingCircle(ST_Collect(geography) and then get the diameter of that.

Re: [postgis-users] Distance between two furthest points of a group

2015-06-26 Thread Nick Ves
You can cross join to create the cartesian product of them and use it to calculate the distance of each with regards to the other: select a.id,b.id, st_distance(a.geom,b.geom) d from points a cross join points b order by d desc limit 1; ofc that will take forever because it will have to create

Re: [postgis-users] Distance between two furthest points of a group

2015-06-26 Thread Rémi Cura
Hm, I don't understand your problem. The circle seems to be the perfect solution. Do you mean the function returns nothing? Maybe you could try to scale down you points(scaling down centered of centroid of your points )?. Cheers, Rémi-C 2015-06-26 13:54 GMT+02:00 Jonathan Moules

[postgis-users] Distance between two furthest points of a group

2015-06-26 Thread Jonathan Moules
Hi List, I have sets of points (up to 250,000 in a set) and I want to get the furthest distance between any of them. In theory the simplest way is to use ST_MinimumBoundingCircle(ST_Collect(geography) and then get the diameter of that. The problem is - I don't seem to be able to get the