From f8631bd4f16f3d4cdc3520b44357e602db5581a3 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Fri, 23 Dec 2011 13:06:28 +0000 Subject: [PATCH] fix some erroneous statements about ST_Clip and provide example demonstrating trimraster argument effect git-svn-id: http://svn.osgeo.org/postgis/trunk@8519 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_raster.xml | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 52e11ba17..45b6dc9d0 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -4906,7 +4906,8 @@ rid | rastbox ST_Clip - Returns a single band raster that is a band clipped by the input geometry. If no band is specified band 1 is assumed. + Returns a single band raster that is a band clipped by the input geometry. If no band is specified band 1 is assumed. If trimraster setting is not specified, false is assumed meaning + the output raster has the same extent as the input raster. @@ -4916,7 +4917,7 @@ rid | rastbox raster rast geometry geom double precision nodata=NULL - boolean trimraster=true + boolean trimraster=false @@ -4925,14 +4926,14 @@ rid | rastbox integer band geometry geom double precision nodata=NULL - boolean trimraster=true + boolean trimraster=false raster ST_Clip raster rast geometry geom - boolean trimraster=true + boolean trimraster @@ -4940,7 +4941,7 @@ rid | rastbox raster rast integer band geometry geom - boolean trimraster=true + boolean trimraster @@ -4948,20 +4949,35 @@ rid | rastbox Description - Returns a single band raster that is a band clipped by the input geometry geom. If no band is specified band 1 is assumed. + Returns a single band raster that is a band clipped by the input geometry geom. If no band is specified band 1 is assumed. If trimraster setting is not specified, false is assumed meaning + the output raster has the same extent as the input raster. If trimraster is set to true, the new raster has the same extent as the intersection of geomand rast. Availability: 2.0.0 Examples here use Massachusetts aerial data available on MassGIS site MassGIS Aerial Orthos. Coordinates are in Massachusetts State Plane Meters. - Examples: 1 band clipping - - --- Clip the first band of an aerial tile by a 20 meter buffer. Trimming raster + Examples: 1 band clipping +-- Clip the first band of an aerial tile by a 20 meter buffer. SELECT ST_Clip(rast, ST_Buffer(ST_Centroid(ST_Envelope(rast)),20) ) from aerials.boston WHERE rid = 4; + +-- Demonstrate effect of trimraster on final dimensions of raster +-- Note how in trimmed final envelope is clipped to that of the clipper +-- if trimraster = true +SELECT ST_XMax(ST_Envelope(ST_Clip(rast,clipper,true))) As xmax_w_trim, + ST_XMax(clipper) As xmax_clipper, + ST_XMax(ST_Envelope(ST_Clip(rast,clipper,false))) As xmax_wo_trim, + ST_XMax(ST_Envelope(rast)) As xmax_rast_orig +FROM (SELECT rast, ST_Buffer(ST_Centroid(ST_Envelope(rast)),6) As clipper + FROM aerials.boston +WHERE rid = 6) As foo; + + xmax_w_trim | xmax_clipper | xmax_wo_trim | xmax_rast_orig +------------------+------------------+------------------+------------------ + 230657.436173996 | 230657.436173996 | 230666.436173996 | 230666.436173996 + @@ -4993,7 +5009,7 @@ WHERE rid = 4; Examples: Multi-band clipping --- Clip all bands of an aerial tile by a 20 meter buffer. Trimming raster +-- Clip all bands of an aerial tile by a 20 meter buffer. SELECT ST_AddBand(NULL, ARRAY[ST_Clip(rast, 1, clipper), ST_Clip(rast, 2, clipper), -- 2.50.1