20 | | ---- |
21 | | == '''Objective 2.0.04 - Implement better support for NULL, Empty, !HasNoBand(rast), !HasNoBand(rast, band) and !BandIsNoData rasters in all functions.''' == |
22 | | |
23 | | Each function should better handle NULL rasters, empty rasterm rasters with no band and bands only filled with nodata values. |
24 | | |
25 | | 1) 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. |
26 | | |
27 | | 2) 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. |
28 | | |
29 | | 2) 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. |
30 | | |
31 | | 4) A !BandIsNoData raster is a normal raster but many functions can be optimized with this type of raster. |
32 | | |
33 | | 5) 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. |
34 | | |
35 | | 6) Try as less as possible to return EXCEPTION (or ERROR). |
36 | | |
37 | | See discussion in http://trac.osgeo.org/postgis/ticket/594 |
38 | | |
39 | | '''ST_IsEmpty(rast) -> boolean''' |
40 | | |
41 | | Returns TRUE if the raster width or the raster height is 0. |
42 | | |
43 | | '''ST_HasNoBand''' |
44 | | |
45 | | '''Variants''' |
46 | | |
47 | | 1) ST_HasNoBand(rast, band) -> boolean |
48 | | |
49 | | 2) ST_HasNoBand(rast) -> boolean |
50 | | |
51 | | Returns TRUE if the the raster does not have this band. |
52 | | |
53 | | Variant 2 returns TRUE if the the raster does not have any band. |
54 | | |
55 | | '''ST_BandIsNoData''' |
56 | | |
57 | | '''Variants''' |
58 | | |
59 | | 1) ST_BandIsNoData(rast, band) -> boolean |
60 | | |
61 | | 2) ST_BandIsNoData(rast) -> boolean |
62 | | |
63 | | Returns TRUE if the specified raster band is only filled with no data value. |
64 | | |
65 | | Variant 2 default to band 1. |
66 | | |
67 | | '''Implementation details''' |
68 | | |
69 | | This require a new flag to be set in the core at import and at edition. See discussion in http://trac.osgeo.org/postgis/ticket/593 |
| 462 | == '''Objective FV.22 - Implement better support for NULL, Empty, !HasNoBand(rast), !HasNoBand(rast, band) and !BandIsNoData rasters in all functions.''' == |
| 463 | |
| 464 | Each function should better handle NULL rasters, empty rasterm rasters with no band and bands only filled with nodata values. |
| 465 | |
| 466 | 1) 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. |
| 467 | |
| 468 | 2) 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. |
| 469 | |
| 470 | 2) 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. |
| 471 | |
| 472 | 4) A !BandIsNoData raster is a normal raster but many functions can be optimized with this type of raster. |
| 473 | |
| 474 | 5) 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. |
| 475 | |
| 476 | 6) Try as less as possible to return EXCEPTION (or ERROR). |
| 477 | |
| 478 | See discussion in http://trac.osgeo.org/postgis/ticket/594 |
| 479 | |
| 480 | '''ST_IsEmpty(rast) -> boolean''' |
| 481 | |
| 482 | Returns TRUE if the raster width or the raster height is 0. |
| 483 | |
| 484 | '''ST_HasNoBand''' |
| 485 | |
| 486 | '''Variants''' |
| 487 | |
| 488 | 1) ST_HasNoBand(rast, band) -> boolean |
| 489 | |
| 490 | 2) ST_HasNoBand(rast) -> boolean |
| 491 | |
| 492 | Returns TRUE if the the raster does not have this band. |
| 493 | |
| 494 | Variant 2 returns TRUE if the the raster does not have any band. |
| 495 | |
| 496 | '''ST_BandIsNoData''' |
| 497 | |
| 498 | '''Variants''' |
| 499 | |
| 500 | 1) ST_BandIsNoData(rast, band) -> boolean |
| 501 | |
| 502 | 2) ST_BandIsNoData(rast) -> boolean |
| 503 | |
| 504 | Returns TRUE if the specified raster band is only filled with no data value. |
| 505 | |
| 506 | Variant 2 default to band 1. |
| 507 | |
| 508 | '''Implementation details''' |
| 509 | |
| 510 | This require a new flag to be set in the core at import and at edition. See discussion in http://trac.osgeo.org/postgis/ticket/593 |
| 511 | |
| 512 | ---- |