PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ 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 1909 of file rt_band.c.

1909  {
1910  int i, j, err;
1911  double pxValue;
1912  int isnodata = 0;
1913 
1914  assert(NULL != band);
1915  band->isnodata = FALSE;
1916 
1917  /* Check if band has nodata value */
1918  if (!band->hasnodata) {
1919  RASTER_DEBUG(3, "Band has no NODATA value");
1920  return FALSE;
1921  }
1922 
1923  pxValue = band->nodataval;
1924 
1925  /* Check all pixels */
1926  for (i = 0; i < band->width; i++) {
1927  for (j = 0; j < band->height; j++) {
1928  err = rt_band_get_pixel(band, i, j, &pxValue, &isnodata);
1929  if (err != ES_NONE) {
1930  rterror("rt_band_check_is_nodata: Cannot get band pixel");
1931  return FALSE;
1932  }
1933  else if (!isnodata) {
1934  band->isnodata = FALSE;
1935  return FALSE;
1936  }
1937  }
1938  }
1939 
1940  band->isnodata = TRUE;
1941  return TRUE;
1942 }
#define TRUE
Definition: dbfopen.c:73
#define FALSE
Definition: dbfopen.c:72
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:219
#define RASTER_DEBUG(level, msg)
Definition: librtcore.h:302
@ ES_NONE
Definition: librtcore.h:182
band
Definition: ovdump.py:58
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
Definition: rt_band.c:1376

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

Referenced by 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: