creating a polygon from points around a point in p

2019-08-10 12:46发布

问题:

I have a postgresql db using postgis 2.0 and a table of thousands of points, I would like create a polygon of the furthest points originating around a particular central location. I haven't got a clue how this would be done, any ideas anyone??

回答1:

Filter and aggregate the points, and return the convex hull of the points.

So to select the points in mytable that are within a distance of 10 from id=123, and return the enclosing polygon:

SELECT ST_ConvexHull(ST_Collect(A.geom))
FROM mytable A, mytable B
WHERE B.id=123 AND ST_DWithin(A.geom, B.geom, 10)