user1051849
user1051849

Reputation: 2337

Creating Postgis Polygon using ST_ConcaveHull from Geometry Points

I have a postgis 2.2 table with 20 columns of type geometry(Point,4326)

I'd like to generate a polygon which covers the outer boundary of the points - it seems like ST_ConcaveHull is a good option, but I can't see how to do it without first converting my points back to text (which seems to be missing the point).

Is st_concavehull the right option, and how do I go about constructing the query?

Thanks!

Upvotes: 0

Views: 1172

Answers (1)

songololo
songololo

Reputation: 4954

You first need to collect your points, then pass this collection to ST_ConcaveHull:

ST_ConcaveHull(ST_Collect(geom), 1)

Per the ST_ConcaveHull documentation:

Although it is not an aggregate - you can use it in conjunction with ST_Collect or ST_Union to get the concave hull of a set of points/linestring/polygons ST_ConcaveHull(ST_Collect(somepointfield), 0.80).

Upvotes: 2

Related Questions