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))