ST_ConvexHull
更新时间:
复制 MD 格式
Returns the minimum convex geometry that encloses all geometries within a raster.
Syntax
geometry ST_ConvexHull(raster source);
geometry ST_ConvexHull(raster source, integer pyramid);Parameters
| Parameter | Description |
|---|---|
source | The raster to compute the convex hull for. |
pyramid | The pyramid level of the raster. Valid values start from 0. Default value: 0. |
Description
ST_ConvexHull computes the minimum convex geometry that encloses all geometries within a raster. Think of it as stretching a rubber band around the full extent of the raster — the result is always a geometry value.

Examples
Get the convex hull of a raster at the default pyramid level (0):
SELECT ST_AsText(ST_ConvexHull(rast_object))
FROM raster_table;
----------------------------------------------------
POLYGON((-180 90,180 90,180 -90,-180 -90,-180 90))Get the convex hull at a specific pyramid level:
-- Specify the pyramid level at which the raster resides.
SELECT ST_AsText(ST_ConvexHull(rast_object, 1))
FROM raster_table;
----------------------------------------------------
POLYGON((-180 90,180 90,180 -90,-180 -90,-180 90))该文章对您有帮助吗?