postgresql 如何获得点周围的边界多边形?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2062992/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do i get a bounding polygon around points?
提问by ADAM
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?
postgis 中是否有一个函数可以让我在这些点周围获得一个边界多边形并将其作为多边形返回?
updateI am looking for a more complex polygon than just a bounding rectangle
更新我正在寻找一个比边界矩形更复杂的多边形
回答by mloskot
It may be not 100% clear from your question what you mean as more bounding polygon. It may be understood as
从您的问题中可能不是 100% 清楚您的意思是更边界多边形。可以理解为
minimum bounding rectangle(also known as MBR or envelope) for which you can use ST_Envelope, ST_Box2Dor ST_Extent,
as s a minimum geometry which encloses all points within given geometry, a convex envelopeand in this case you can use ST_ConvexHullor even ST_ExteriorRingif your input would be a polygon,
As Pimin pointed in the comments below, ST_ConcaveHullis another option worth to consider, available since PostGIS 2.0.0.
您可以使用ST_Envelope、ST_Box2D或ST_Extent 的最小边界矩形(也称为 MBR 或信封),
作为包含给定几何图形中所有点的最小几何图形,一个凸包络,在这种情况下,如果您的输入是多边形,您可以使用ST_ConvexHull甚至ST_ExteriorRing,
正如 Pimin 在下面的评论中指出的那样,ST_ConcaveHull是另一个值得考虑的选项,从 PostGIS 2.0.0 开始可用。
回答by Andrew McGregor
Sure is, ST_Extent: http://postgis.refractions.net/documentation/manual-1.4/ST_Extent.html
当然是,ST_Extent:http://postgis.refractions.net/documentation/manual-1.4/ST_Extent.html