ST_ConvexHull — Returnerar rastrets konvexa skrovgeometri inklusive pixelvärden som är lika med BandNoDataValue. För regelbundet formade och icke snedställda raster ger detta samma resultat som ST_Envelope, så det är endast användbart för oregelbundet formade eller snedställda raster.
geometry ST_ConvexHull(raster rast);
Returnerar rastrets konvexa skrovgeometri inklusive NoDataBandValue-bandpixlarna. För regelbundet formade och icke-skeva raster ger detta mer eller mindre samma resultat som ST_Envelope, så det är endast användbart för oregelbundet formade eller skeva raster.
|
|
|
ST_Envelope golvar koordinaterna och lägger därför till en liten buffert runt rastret så svaret är subtilt annorlunda än ST_ConvevexHull som inte golvar. |
Se PostGIS Raster Specification för ett diagram över detta.
-- 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))