ST_Raster.crop

Definition

The ST_Raster.crop function crops an existing ST_Raster object to the specified extent. The extent can be specified in either geographic or pixel coordinates. The function can only be applied within a SQL UPDATE statement. A database error is returned if it is used anywhere else, such as a SELECT statement or a WHERE clause. To obtain the same sort of functionality within the select list of the SQL SELECT statement, refer to the ST_Raster.subset function.

Syntax

Oracle

crop (extent IN VARCHAR2) RETURN ST_RASTER

crop (extent IN VARCHAR2, 
      unit IN VARCHAR2) RETURN ST_RASTER

PostgreSQL

crop (raster IN ST_RASTER, 
      extent IN TEXT) RETURN ST_RASTER

crop (raster IN ST_RASTER, 
      extent IN TEXT, 
      unit IN TEXT) RETURN ST_RASTER

SQL Server

crop (extent IN NVARCHAR, 
      unit IN NVARCHAR) RETURN ST_RASTER

Returns

ST_Raster

Parameters

Parameters

Description

extent <minx,miny,maxx,maxy>

The extent of the ST_Raster to be cropped, specified in geographic coordinates

raster

The ST_Raster value to be cropped

unit <'pixel'>

When the pixel keyword is included, the extent is entered as pixel coordinates. Omitting the pixel argument indicates that the extent shall be entered as geographic coordinates.

Examples

The following examples crop the existing raster with the specified crop region of (0,0,100,100):

Oracle

UPDATE IMAGE2 
SET image = image.crop ('0,0,100,100', 'pixel');

PostgreSQL

UPDATE image2 
SET image = crop (image, '0,0,100,100', 'pixel');

SQL Server

UPDATE image2 
SET image = image.crop ('0,0,100,100', 'pixel');

3/7/2012