PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rt_band_check_is_nodata()

int rt_band_check_is_nodata ( rt_band  band)

Returns TRUE if the band is only nodata values.

Parameters
band: the band to get info from
Returns
TRUE if the band is only nodata values, FALSE otherwise

Definition at line 2089 of file rt_band.c.

2089 {
2090 int i, j, err;
2091 double pxValue;
2092 int isnodata = 0;
2093
2094 assert(NULL != band);
2095 band->isnodata = FALSE;
2096
2097 /* Check if band has nodata value */
2098 if (!band->hasnodata) {
2099 RASTER_DEBUG(3, "Band has no NODATA value");
2100 return FALSE;
2101 }
2102
2103 pxValue = band->nodataval;
2104
2105 /* Check all pixels */
2106 for (i = 0; i < band->width; i++) {
2107 for (j = 0; j < band->height; j++) {
2108 err = rt_band_get_pixel(band, i, j, &pxValue, &isnodata);
2109 if (err != ES_NONE) {
2110 rterror("rt_band_check_is_nodata: Cannot get band pixel");
2111 return FALSE;
2112 }
2113 else if (!isnodata) {
2114 band->isnodata = FALSE;
2115 return FALSE;
2116 }
2117 }
2118 }
2119
2120 band->isnodata = TRUE;
2121 return TRUE;
2122}
#define TRUE
Definition dbfopen.c:73
#define FALSE
Definition dbfopen.c:72
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
#define RASTER_DEBUG(level, msg)
Definition librtcore.h:304
@ ES_NONE
Definition librtcore.h:182
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
Definition rt_band.c:1551

References ES_NONE, FALSE, RASTER_DEBUG, rt_band_get_pixel(), rterror(), and TRUE.

Referenced by convert_raster(), RASTER_bandIsNoData(), RASTER_setBandNoDataValue(), test_band_metadata(), test_band_new_offline_from_path(), and test_raster_to_gdal().

Here is the call graph for this function:
Here is the caller graph for this function: