ST_ConvexHull — 返回栅格的凸包几何,包括像素值等于 BandNoDataValue。对于规则形状且未倾斜的栅格,这与 ST_Envelope 给出的结果相同,因此仅对不规则形状或倾斜的栅格有用。
geometry ST_ConvexHull(
raster rast)
;
返回栅格的凸包几何,包括 NoDataBandValue 波段像素。对于规则形状且未倾斜的栅格,这与 ST_Envelope 给出的结果或多或少相同,因此仅对不规则形状或倾斜的栅格有用。
ST_Envelope 对坐标取整,因此在栅格周围添加了一个小缓冲区,所以答案与不取整的 ST_ConvexHull 略有不同。 |
请参阅 PostGIS 栅格规范 以获取此图。
-- Note envelope and convexhull are more or less the same SELECT ST_AsText(ST_ConvexHull(rast)) As convhull, ST_AsText(ST_Envelope(rast)) As env FROM dummy_rast WHERE rid=1; convhull | env --------------------------------------------------------+------------------------------------ POLYGON((0.5 0.5,20.5 0.5,20.5 60.5,0.5 60.5,0.5 0.5)) | POLYGON((0 0,20 0,20 60,0 60,0 0))
-- now we skew the raster -- note how the convex hull and envelope are now different SELECT ST_AsText(ST_ConvexHull(rast)) As convhull, ST_AsText(ST_Envelope(rast)) As env FROM (SELECT ST_SetRotation(rast, 0.1, 0.1) As rast FROM dummy_rast WHERE rid=1) As foo; convhull | env --------------------------------------------------------+------------------------------------ POLYGON((0.5 0.5,20.5 1.5,22.5 61.5,2.5 60.5,0.5 0.5)) | POLYGON((0 0,22 0,22 61,0 61,0 0))