| 17 | ---- |
| 18 | == '''Objective B02x - Implement better support for NULL, Empty, HasNoBand(rast), HasNoBand(rast, band) and BandIsNoData rasters in all functions.''' == |
| 19 | |
| 20 | Each function shoul better handle NULL rasters, empty rasterm rasters with no band and bands only filled with nodata values. |
| 21 | |
| 22 | * Generally, when NULL rasters are provided, return NULL. If the function involves a second non NULL raster and something can be done with it, do it. |
| 23 | * Generally, when empty rasters are provided (ST_IsEmpty, width=0 or height=0), return an empty raster. If the function involves a second non empty raster and something can be done with it, do it. |
| 24 | * Generally, when a HasNoBand(rast) or a HasNoBand(rast, band) raster is provided return a raster with no band but with the right extent. If the function involves a second raster having a band or the band, treat the first missing band like a BandIsNoData. |
| 25 | * A BandIsNoData raster is a normal raster but many functions can be optimized with this type of raster. |
| 26 | * All functions having missing the requested information (about its extent when it is a NULL or an empty raster or about its band when it is a HasNoBand(rast) or a HasNoBand(rast, band) raster) should return NULL or a documented value. |
| 27 | * Try as less as possible to return EXCEPTION (or ERROR). |
| 28 | |
| 29 | '''ST_IsEmpty(rast) -> boolean''' |
| 30 | |
| 31 | Returns TRUE if the raster width or the raster height is 0. |
| 32 | |
| 33 | '''ST_HasNoBand(rast, band) -> boolean''' |
| 34 | |
| 35 | Returns TRUE if the the raster does not have this band. |
| 36 | |
| 37 | '''Variants''' |
| 38 | |
| 39 | 1) ST_HasNoBand(rast) -> boolean |
| 40 | |
| 41 | Variant 1 returns TRUE if the the raster does not have any band. |
| 42 | |
| 43 | '''ST_BandIsNoData(rast, band) -> boolean''' |
| 44 | |
| 45 | Returns TRUE if the specified raster band is only filled with no data value. |
| 46 | |
| 47 | '''Variants''' |
| 48 | |
| 49 | 1) ST_BandIsNoData(rast) -> boolean |
| 50 | |
| 51 | Variant 1 default to band 1. |
| 52 | |
| 53 | '''Implementation details''' |
| 54 | |
| 55 | This require a new flag to be set in the core at import and at edition. |
| 56 | |
| 57 | |