From face4b0474c94a21355234132c0e5774ce73611b Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Fri, 26 Oct 2012 00:28:15 +0000 Subject: [PATCH] Added news regarding ST_Clip(raster, ...) in C and update docs git-svn-id: http://svn.osgeo.org/postgis/trunk@10569 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 1 + doc/reference_raster.xml | 334 ++++++++++++++++++++++++--------------- 2 files changed, 211 insertions(+), 124 deletions(-) diff --git a/NEWS b/NEWS index e12d2ae36..80213263a 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,7 @@ PostGIS 2.1.0 to be clipped - #2021, Added multi-band support to ST_Union(raster, ...) aggregate function - #2006, better support of ST_Area(geography) over poles and dateline + - #2065, ST_Clip(raster, ...) now a C function - TopologySummary output now includes unregistered layers and a count of missing TopoGeometry objects from their natural layer. - ST_HillShade(), ST_Aspect() and ST_Slope() have one new optional diff --git a/doc/reference_raster.xml b/doc/reference_raster.xml index 2782bc670..fae54f717 100644 --- a/doc/reference_raster.xml +++ b/doc/reference_raster.xml @@ -7185,60 +7185,101 @@ rid | rastbox ST_Clip - Returns the raster clipped by the input geometry. If no band is specified all bands are returned. If crop is not specified, true is assumed meaning - the output raster is cropped. + Returns the raster clipped by the input geometry. If band number not is specified, all bands are processed. If crop is not specified or TRUE, the output raster is cropped. - + - - raster ST_Clip - raster rast - geometry geom - double precision[] nodataval=NULL - boolean crop=true - - - - raster ST_Clip - raster rast - geometry geom - boolean crop - - - - raster ST_Clip - raster rast - integer band - geometry geom - boolean crop - + + + raster ST_Clip + raster rast + integer[] nband + geometry geom + double precision[] nodataval=NULL + boolean crop=TRUE + + + + raster ST_Clip + raster rast + integer nband + geometry geom + double precision nodataval + boolean crop=TRUE + + + + raster ST_Clip + raster rast + integer nband + geometry geom + boolean crop + + + + raster ST_Clip + raster rast + geometry geom + double precision[] nodataval=NULL + boolean crop=TRUE + + + + raster ST_Clip + raster rast + geometry geom + double precision nodataval + boolean crop=TRUE + + + + raster ST_Clip + raster rast + geometry geom + boolean crop + + - - + + Description - Returns a raster that is clipped by the input geometry geom. If no band is specified all bands are returned. - - Rasters resulting from ST_Clip must have a nodata value assigned for areas clipped, one for each band. If none are provided and the input raster do not have a nodata value defined, nodata values of the resulting raster are set to ST_MinPossibleValue(ST_BandPixelType(rast, band)). When the number of nodata value in the array is smaller than the number of band, the last one in the array is used for the remaining bands. If the number of nodata value is greater than the number of band, the extra nodata values are ignored. All variants accepting an array of nodata values also accept a single value which will be assigned to each band. + + Returns a raster that is clipped by the input geometry geom. If band index is not specified, all bands are processed. + + + + Rasters resulting from ST_Clip must have a nodata value assigned for areas clipped, one for each band. If none are provided and the input raster do not have a nodata value defined, nodata values of the resulting raster are set to ST_MinPossibleValue(ST_BandPixelType(rast, band)). When the number of nodata value in the array is smaller than the number of band, the last one in the array is used for the remaining bands. If the number of nodata value is greater than the number of band, the extra nodata values are ignored. All variants accepting an array of nodata values also accept a single value which will be assigned to each band. + - If crop is not specified, true is assumed meaning the output raster is cropped to the intersection of the geomand rast extents. If crop is set to false, the new raster gets the same extent as rast. + + If crop is not specified, true is assumed meaning the output raster is cropped to the intersection of the geomand rast extents. If crop is set to false, the new raster gets the same extent as 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. + Enhanced: 2.1.0 Rewritten in C + + + 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. + Examples: 1 band clipping + + +-- Clip the first band of an aerial tile by a 20 meter buffer. SELECT ST_Clip(rast, 1, ST_Buffer(ST_Centroid(ST_Envelope(rast)),20) ) from aerials.boston -WHERE rid = 4; +WHERE rid = 4; + --- Demonstrate effect of crop on final dimensions of raster + +-- Demonstrate effect of crop on final dimensions of raster -- Note how final extent is clipped to that of the geometry -- if crop = true SELECT ST_XMax(ST_Envelope(ST_Clip(rast, 1, clipper, true))) As xmax_w_trim, @@ -7252,114 +7293,159 @@ WHERE rid = 6) As foo; xmax_w_trim | xmax_clipper | xmax_wo_trim | xmax_rast_orig ------------------+------------------+------------------+------------------ 230657.436173996 | 230657.436173996 | 230666.436173996 | 230666.436173996 - - - - - - - - - - - Full raster tile before clipping - - - - - - - - - After Clipping - - - - - - - + + + + + + + + + + + + + + + Full raster tile before clipping + + + + + + + + + + + + + + After Clipping + + + + + + + + + + - Examples: 1 band clipping with no crop and add back other bands unchanged --- Same example as before, but we need to set crop to false to be able to use ST_AddBand + Examples: 1 band clipping with no crop and add back other bands unchanged + + +-- Same example as before, but we need to set crop to false to be able to use ST_AddBand -- because ST_AddBand requires all bands be the same Width and height SELECT ST_AddBand(ST_Clip(rast, 1, ST_Buffer(ST_Centroid(ST_Envelope(rast)),20),false ), ARRAY[ST_Band(rast,2),ST_Band(rast,3)] ) from aerials.boston -WHERE rid = 6; - - - - - - - - - - Full raster tile before clipping - - - - - - - - - After Clipping - surreal - - - - - - - +WHERE rid = 6; + + + + + + + + + + + + + + + Full raster tile before clipping + + + + + + + + + + + + + + After Clipping - surreal + + + + + + + + + + - Examples: Clip all bands --- Clip all bands of an aerial tile by a 20 meter buffer. + Examples: Clip all bands + + +-- Clip all bands of an aerial tile by a 20 meter buffer. -- Only difference is we don't specify a specific band to clip -- so all bands are clipped SELECT ST_Clip(rast, ST_Buffer(ST_Centroid(ST_Envelope(rast)), 20), false ) from aerials.boston -WHERE rid = 4; +WHERE rid = 4; + - - - - - - - - - - Full raster tile before clipping - - - - - - - - - After Clipping - - - - - - - + + + + + + + + + + + + + Full raster tile before clipping + + + + + + + + + + + + + + After Clipping + + + + + + + + + + See Also - , + + , + , + + - + ST_ConvexHull -- 2.40.0