PostGIS  2.5.7dev-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 1752 of file rt_band.c.

1752  {
1753  int i, j, err;
1754  double pxValue;
1755  int isnodata = 0;
1756 
1757  assert(NULL != band);
1758 
1759  /* Check if band has nodata value */
1760  if (!band->hasnodata) {
1761  RASTER_DEBUG(3, "Band has no NODATA value");
1762  band->isnodata = FALSE;
1763  return FALSE;
1764  }
1765 
1766  pxValue = band->nodataval;
1767 
1768  /* Check all pixels */
1769  for (i = 0; i < band->width; i++) {
1770  for (j = 0; j < band->height; j++) {
1771  err = rt_band_get_pixel(band, i, j, &pxValue, &isnodata);
1772  if (err != ES_NONE) {
1773  rterror("rt_band_check_is_nodata: Cannot get band pixel");
1774  return FALSE;
1775  }
1776  else if (!isnodata) {
1777  band->isnodata = FALSE;
1778  return FALSE;
1779  }
1780  }
1781  }
1782 
1783  band->isnodata = TRUE;
1784  return TRUE;
1785 }
#define TRUE
Definition: dbfopen.c:169
#define FALSE
Definition: dbfopen.c:168
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
Definition: rt_context.c:199
#define RASTER_DEBUG(level, msg)
Definition: librtcore.h:295
@ ES_NONE
Definition: librtcore.h:180
band
Definition: ovdump.py:57
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
Definition: rt_band.c:1221

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: