ST_Raster.mosaic

Definition

The ST_Raster.mosaic function merges the input image or images with an existing ST_Raster object. This function is intended for UPDATE statements only. A database error will be returned when used in a SELECT statement.

The ST_Raster.mosaic function is executed within a single transaction, so consideration must be given to the number of source rasters to be mosaicked at one time, with respect to the amount of rollback space available to accommodate the pending transaction.

When source raster data is on a network drive, appropriate file access permission must be granted to the owner of the current database process.

Syntax

Oracle

mosaic (filename IN VARCHAR2) RETURN ST_RASTER

mosaic (filename IN VARCHAR2, 
        parameter_list IN VARCHAR2) RETURN ST_RASTER

mosaic (data IN ST_PIXELDATA) RETURN ST_RASTER

mosaic (data IN ST_PIXELDATA, 
        parameter_list IN VARCHAR2) RETURN ST_RASTER

PostgreSQL

mosaic (raster IN ST_RASTER, 
        filename IN TEXT) RETURN ST_RASTER

mosaic (raster IN ST_RASTER, 
        filename IN TEXT, 
        parameter_list IN TEXT) RETURN ST_RASTER

mosaic (raster IN ST_RASTER, 
        data IN ST_PIXELDATA) RETURN ST_RASTER

mosaic (raster IN ST_RASTER, 
        data IN ST_PIXELDATA, 
        parameter_list IN TEXT) RETURN ST_RASTER

SQL Server

mosaic (filename IN NVARCHAR, 
        data IN ST_PIXELDATA, 
        parameter_list IN NVARCHAR) RETURN ST_RASTER

Returns

ST_Raster

Parameters

Parameter

Description

filename

The file name or names of the source raster data

The file name can contain operating system wildcard characters. Or it could be a SQL SELECT statement that selects a single ST_Raster column from a user-defined table. The supported image file format is GeoTIFF.

data

A predefined ST_PixelData object

raster

The ST_Raster target value to which the designated image is to be mosaicked

parameter_list

A comma-delimited list of parameters enclosed in single quotes that may include the following parameters:

  • align—Perform extent snapping of the source raster to the target ST_Raster.
  • recursive—If a wildcard argument is provided as the source data path, search all subfolders recursively of the top-level folder provided.
  • conversion <rgb | grayscale>—When set to rgb, the conversion parameter directs the mosaic function to convert single-band, color-mapped source images to a three-band RGB ST_Raster object. A conversion parameter set to grayscale indicates that the mosaic function should convert 1-bit black-and-white source images into an 8-bit grayscale ST_Raster.
  • quality <value>—If the compression type of the base layer is JPEG or JPEG 2000, the compression quality of the pyramid is controlled by setting this parameter. The default for JPEG compression is 75, while the default for JPEG 2000 compression is 0.
  • bitrate <value>—The bitrate for JPEG 2000 fixed compression
  • nodata (r,g,b) | <value>—The pixel values of the source image that are converted to nodata as they are mosaicked into the ST_Raster
  • nocolormap—Indicates that the color map will be removed from a color-mapped source image when it is mosaicked into the ST_Raster
  • edge <value>:<tolerance>—Removes the unwanted boundary pixels around an ST_Raster that are marked as NoData; edge indicates that only the pixels in the specified value range will be removed and only from the outside edge of the raster. This prevents pixels of the same value within the raster from being removed.
  • level <pyramid level>—The maximum pyramid level of the ST_Raster that will exist after the source image is mosaicked into the ST_Raster
  • skipLevel1—Directs the function to not store the first pyramid level
  • nearest | bilinear | bicubic—The interpolation algorithm used to build the pyramid; defaults to nearest
  • log <logfile name>—The log file captures the results of the mosaic function as it mosaics the source data.
  • erase—Enables the delete mode for mosaic; for any given input NoData, removes the corresponding pixel data from the resultant raster.

Examples

These examples illustrates the following:

  1. Create a mosaic of all the TIFFs under the path E:\data and all its subfolders to an existing ST_Raster object. The results of the mosaic function are written to the log file E:\'log.txt'.
  2. Populate an ST_PixelData object with the pixels of an ST_Raster object and then mosaic it to another ST_Raster object.

Oracle

  1. UPDATE SAT t
    SET image = t.image.mosaic('E:\data\*.tif',
                               'recursive,log=E:\log.txt');
  2. DECLARE
      	  data sde.ST_PIXELDATA;
     BEGIN
      	  SELECT t.image.getPixelData('level=1') 
         INTO DATA 
         FROM SAT t;
    
      	  UPDATE SAT t
    	    SET image = t.image.mosaic(data,'log=E:\log.txt'); 
     END; 
     /

PostgreSQL

  1. UPDATE sat
    SET image = mosaic(image,'E:\data\*.tif',
                      'recursive,log=E:\log.txt');
  2. DROP FUNCTION IF EXISTS mosaic_from_pixeldata();
    
    CREATE OR REPLACE FUNCTION mosaic_from_pixeldata() 
    RETURNS integer AS '
    DECLARE data sde.st_pixeldata; 
     BEGIN 
      	  SELECT getPixelData(image) 
         INTO data 
      	  FROM sat; 
      	  UPDATE sat 
      	  SET image = mosaic(image,data,''log=E:\log.txt'') 
      	  WHERE name = ''1_1_data'';
     END;' 
    LANGUAGE plpgsql; 
    
         SELECT mosaic_from_pixeldata();
    
    DROP FUNCTION IF EXISTS mosaic_from_pixeldata();

SQL Server

  1. UPDATE sat
    SET image = image.mosaic('E:\data\*.tif',NULL,
                             'recursive,log=E:\log.txt');

  2. DECLARE
    @data ST_PIXELDATA;
     SET @data = (SELECT image.getPixelData('level=1')
     FROM sat);
    
    UPDATE sat
    SET image = image.mosaic(NULL,@data,'log=E:\log.txt');

11/18/2013