Changes between Version 67 and Version 68 of WKTRaster/SpecificationWorking03


Ignore:
Timestamp:
Apr 23, 2011, 8:22:27 AM (13 years ago)
Author:
Bborie Park
Comment:

Fleshed out ST_AsPNG

Legend:

Unmodified
Added
Removed
Modified
  • WKTRaster/SpecificationWorking03

    v67 v68  
    357357----
    358358'''ST_AsPNG(raster, band) -> PNG as "bytea"'''
     359
     360Bborie: Like the JPEG raster format, the PNG format has limitations:
     361
     362  1. PNG only allows 1 (greyscale) or 3 (RGB) bands of data
     363
     364  2. PNG only supports 8BUI and 16BUI pixeltypes. Any other pixeltype will be written as 8BUI, though the results are probably useless
     365
     366  3. PNG cannot embed spatial reference information within the file but can have an associated world file
     367
     368Like JPEG, the limitations can be resolved:
     369
     370  1. Use ST_Band to specify which band(s) should be passed to the ST_AsPNG function. If a raster whose number of specified bands does not equal 1 or 3 is provided, a warning is raised and the first or the first three bands are used.
     371
     372  2. Throw an exception if any of the specified bands is not 8BUI or 16BUI. The user should use ST_Reclass to convert any non-8BUI or 16BUI bands to 8BUI or 16BUI.
     373
     374  3. Nothing can be done within this function. ST_Georeference() can be used to the contents of the associated world file
     375
     376A proposed set of variations of the ST_AsPNG function:
     377
     3781. ST_AsPNG(rast raster, options text[])
     379
     380    rast: the raster with one or three bands in 8BUI or 16BUI pixel type to generate a PNG image from
     381
     382    options: array of creation options to pass to the GDAL JPEG driver
     383
     384{{{
     385ST_AsPNG(rast, ARRAY['ZLEVEL=9'])
     386}}}
     387
     3882. ST_AsPNG(rast raster)
     389
     390    Like !#1 above but use the driver's default creation options
     391
     3923. ST_AsPNG(rast raster, nbands int[], options text[])
     393
     394    nbands: an integer array specifying the band indices of the raster to include in the PNG file
     395
     396{{{
     397ST_AsPNG(rast, ARRAY[3,1,2], ARRAY['ZLEVEL=9'])
     398}}}
     399
     4004. ST_AsPNG(rast raster, nbands int[])
     401
     402    Like !#3, but use the default creation options
     403
     404{{{
     405ST_AsPNG(rast, ARRAY[3])
     406}}}
     407
     4085. ST_AsPNG(rast raster, nbands int[], compression int)
     409
     410    compression: number between 1 and 9 indicating the amount of time to spend on compression. 1 is fastest with least compression. 9 is slowest with best compression
     411
     412{{{
     413ST_AsPNG(rast, ARRAY[2,1,3], 3)
     414}}}
     415
     4166. ST_AsPNG(rast raster, nband int, options text[])
     417
     418    nband: index of the band to include
     419
     420{{{
     421ST_AsPNG(rast, 2, ARRAY['ZLEVEL=5'])
     422}}}
     423
     4247. ST_AsPNG(rast raster, nband int, compression int)
     425
     426{{{
     427ST_AsPNG(rast, 1, 8)
     428}}}
     429
     4308. ST_AsPNG(rast raster, nband int)
     431
     432{{{
     433ST_AsPNG(rast, 1)
     434}}}
    359435
    360436----