| 43 | |
| 44 | '''Bborie: A complete implementation of ST_Band would include the following: |
| 45 | |
| 46 | ST_Band(rast raster, nbands int[]) -> raster |
| 47 | |
| 48 | nbands is an array of 1-based band indices of the bands to copy into the output raster |
| 49 | |
| 50 | Ex: For a raster rast with 3 bands: |
| 51 | |
| 52 | ST_Band(rast, ARRAY[1,3,2]) |
| 53 | |
| 54 | ST_Band(rast, ARRAY[3,2,1]) |
| 55 | |
| 56 | You can rearrange the bands as above. You can also duplicate the bands: |
| 57 | |
| 58 | ST_Band(rast, ARRAY[1,2,3,2,1]) |
| 59 | |
| 60 | ST_Band(rast raster, nband int) -> raster |
| 61 | |
| 62 | nband is a single integer of the 1-based band index of the band to copy into the output raster |
| 63 | |
| 64 | Ex: ST_Band(rast, 1) |
| 65 | |
| 66 | ST_Band(rast, 3) |
| 67 | |
| 68 | ST_Band(rast raster, nbands text) -> raster |
| 69 | |
| 70 | nbands is a comma separated string of 1-based band indices indicating the bands to copy into the output raster |
| 71 | |
| 72 | Ex: ST_Band(rast, '1,2') |
| 73 | |
| 74 | ST_Band(rast, '1,2,3, 1, 1 , 2') |
| 75 | |
| 76 | ST_Band(rast raster) -> raster |
| 77 | |
| 78 | the band to extract is automatically assumed to be one. |
| 79 | |
| 80 | Ex: ST_Band(rast) |
| 81 | |
| 82 | If an index is outside the valid range of band indices for a raster (less than 1 or greater than the value returned by ST_NumBands), the function will fail and return. |
| 83 | |
| 84 | ''' Open Question: ''' Should the function fail if an index is invalid? How should this work when providing more than one indices to the function? |