Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get a bounding polygon around points?

I have a table with thousands of addresses as points.

Is there a function in postgis that will allow me to get a bounding polygon around these points and return it as a polygon?

update I am looking for a more complex polygon than just a bounding rectangle

like image 670
ADAM Avatar asked Jan 14 '10 08:01

ADAM


2 Answers

It may be not 100% clear from your question what you mean as more bounding polygon. It may be understood as

  • minimum bounding rectangle (also known as MBR or envelope) for which you can use ST_Envelope, ST_Box2D or ST_Extent,

  • as s a minimum geometry which encloses all points within given geometry, a convex envelope and in this case you can use ST_ConvexHull or even ST_ExteriorRing if your input would be a polygon,

  • As Pimin pointed in the comments below, ST_ConcaveHull is another option worth to consider, available since PostGIS 2.0.0.

like image 77
mloskot Avatar answered Nov 12 '22 15:11

mloskot


ST_Extent provides an aggregate function that returns a bounding box that bounds a set of geometries.

like image 20
Andrew McGregor Avatar answered Nov 12 '22 15:11

Andrew McGregor