PostGIS 3.6.2dev-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 2060 of file rt_band.c.

2060 {
2061 int i, j, err;
2062 double pxValue;
2063 int isnodata = 0;
2064
2065 assert(NULL != band);
2066 band->isnodata = FALSE;
2067
2068 /* Check if band has nodata value */
2069 if (!band->hasnodata) {
2070 RASTER_DEBUG(3, "Band has no NODATA value");
2071 return FALSE;
2072 }
2073
2074 pxValue = band->nodataval;
2075
2076 /* Check all pixels */
2077 for (i = 0; i < band->width; i++) {
2078 for (j = 0; j < band->height; j++) {
2079 err = rt_band_get_pixel(band, i, j, &pxValue, &isnodata);
2080 if (err != ES_NONE) {
2081 rterror("rt_band_check_is_nodata: Cannot get band pixel");
2082 return FALSE;
2083 }
2084 else if (!isnodata) {
2085 band->isnodata = FALSE;
2086 return FALSE;
2087 }
2088 }
2089 }
2090
2091 band->isnodata = TRUE;
2092 return TRUE;
2093}
#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:302
@ 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:1527

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: