ST_Raster.export
Definition
The ST_Raster.export function writes either all or part of an ST_Raster object to an image file. This function was designed to be used only as part of the select list of a SQL SELECT statement.
Syntax
Oracle
export (filename IN VARCHAR2) RETURN VARCHAR2 export (filename IN VARCHAR2, parameter_list IN VARCHAR2) RETURN VARCHAR2
PostgreSQL
export (raster IN ST_RASTER, filename IN TEXT) RETURN TEXT export (raster IN ST_RASTER, filename IN TEXT, parameter_list IN TEXT) RETURN TEXT
SQL Server
export (filename IN NVARCHAR, parameter_list IN NVARCHAR) RETURN NVARCHAR
Returns
VARCHAR
Parameters
Parameters | Descriptions |
---|---|
filename | The name of the exported raster file The filename parameter is a VARCHAR, so it must be enclosed in single quotes. The extension of the file name determines the raster format that will be used to export the file. Currently, the supported raster format for export is GeoTIFF. Therefore, append the .tif extension. |
raster | The ST_Raster value to be exported |
parameter_list | A comma-delimited list of parameters enclosed in single quotes that may include the following parameters:
|
Examples
These examples show the following:
- How to export an ST_Raster object to a GeoTIFF file called border.tif
- How to export the second pyramid level of an ST_Raster object, a GeoTIFF file, and pyramid.tif, in descending band sequence order
In these examples, the files are exported to the location on the DBMS server where SQL is processed. You will likely include a specific path with your file name. Be sure that path is valid for the DBMS server.
Oracle
-
SELECT image.export('border.tif', 'compression=zip') FROM BORDER t WHERE t.image.raster_id = 10;
-
SELECT image.export('pyramid.tif', 'level=2, band=(3,2,1)') FROM BORDER WHERE image.raster_id = 20;
PostgreSQL
-
SELECT export(image,'border.tif', 'compression=zip') FROM border WHERE raster_id(image) = 10;
-
SELECT export(image, 'pyramid.tif', 'level=2, band=(3,2,1)') FROM border WHERE raster_id(image) = 20;
SQL Server
-
SELECT image.export('border.tif', 'compression=zip') FROM border WHERE image.raster_id = 10;
-
SELECT image.export('pyramid.tif', 'level=2, band=(3,2,1)') FROM border WHERE image.raster_id = 20;