| 188 | Bborie: this is a generic interface to outputting a supported and installed GDAL raster: |
| 189 | |
| 190 | ST_AsGDALRaster(rast raster, format text, options text[], srs text) -> bytea |
| 191 | |
| 192 | This is the most generic and GDAL-specific method to convert a raster to a GDAL raster. Reference information for the format and options arguments of a particular format are specified at: http://gdal.org/formats_list.html. The arguments specified are: |
| 193 | |
| 194 | format: the GDAL format code. e.g. GTiff, JPEG, PNG |
| 195 | |
| 196 | options: the GDAL creation options found in the '''Creation Options''' section of a specified format. e.g. COMPRESS=JPEG, JPEG_QUALITY=90 |
| 197 | |
| 198 | srs: the user-specified OGC WKT or the proj4 text for a spatial reference to embed in the GDAL raster. Not all formats support embedding this information. e.g. the non-empty value for the srtext or proj4text column from the spatial_ref_sys table. |
| 199 | |
| 200 | Ex: ST_AsGDALRaster(rast, 'GTiff', ARRAY['COMPRESS=JPEG', 'JPEG_QUALITY=90'], '+proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000 +ellps=GRS80 +datum=NAD83 +units=m +no_defs') |
| 201 | |
| 202 | ST_AsGDALRaster(rast, 'GTiff', ARRAY['COMPRESS=JPEG', 'JPEG_QUALITY=90'], 'PROJCS["NAD83 / California Albers",GEOGCS["NAD83",DATUM["North_American_Datum_1983",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6269"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4269"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["standard_parallel_1",34],PARAMETER["standard_parallel_2",40.5],PARAMETER["latitude_of_center",0],PARAMETER["longitude_of_center",-120],PARAMETER["false_easting",0],PARAMETER["false_northing",-4000000],AUTHORITY["EPSG","3310"],AXIS["X",EAST],AXIS["Y",NORTH]]') |
| 203 | |
| 204 | ST_AsGDALRaster(rast raster, format text, options text[]) -> bytea |
| 205 | |
| 206 | This one removes the user-specified srs argument. The output GDAL raster's spatial reference will be set to the same as the input raster, if possible. |
| 207 | |
| 208 | Ex: ST_AsGDALRaster(rast, 'JPEG', ARRAY['QUALITY=50']) |
| 209 | |
| 210 | ST_AsGDALRaster(rast, 'PNG', ARRAY['ZLEVEL=7']) |
| 211 | |
| 212 | ST_AsGDALRaster(rast raster, format text) -> bytea |
| 213 | |
| 214 | The simplest implementation of this function. Since the options argument has been removed, the output GDAL raster will be created with default options. Like the prior function, the spatial reference of the GDAL raster will be set to the same as the input raster. |
| 215 | |
| 216 | ST_AsGDALRaster and other format specific functions (ST_AsJPEG, ST_AsTIFF and ST_AsPNG) are all wrappers around the function |
| 217 | |
| 218 | _ST_AsGDALRaster(rast raster, format text, options text[], srs text) |