PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ rtpg_union_range_callback()

static int rtpg_union_range_callback ( rt_iterator_arg  arg,
void *  userarg,
double *  value,
int *  nodata 
)
static

Definition at line 1864 of file rtpg_mapalgebra.c.

References rt_iterator_arg_t::columns, rt_iterator_arg_t::nodata, POSTGIS_RT_DEBUGF, rt_iterator_arg_t::rasters, rt_iterator_arg_t::rows, and rt_iterator_arg_t::values.

Referenced by RASTER_union_finalfn().

1867  {
1868  if (arg == NULL)
1869  return 0;
1870 
1871  if (
1872  arg->rasters != 2 ||
1873  arg->rows != 1 ||
1874  arg->columns != 1
1875  ) {
1876  elog(ERROR, "rtpg_union_range_callback: Invalid arguments passed to callback");
1877  return 0;
1878  }
1879 
1880  *value = 0;
1881  *nodata = 1;
1882 
1883  POSTGIS_RT_DEBUGF(4, "rast0: %f %d", arg->values[0][0][0], arg->nodata[0][0][0]);
1884  POSTGIS_RT_DEBUGF(4, "rast1: %f %d", arg->values[1][0][0], arg->nodata[1][0][0]);
1885 
1886  if (
1887  !arg->nodata[0][0][0] &&
1888  !arg->nodata[1][0][0]
1889  ) {
1890  *value = arg->values[1][0][0] - arg->values[0][0][0];
1891  *nodata = 0;
1892  }
1893 
1894  POSTGIS_RT_DEBUGF(4, "value, nodata = (%f, %d)", *value, *nodata);
1895 
1896  return 1;
1897 }
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:57
uint32_t columns
Definition: librtcore.h:2418
uint16_t rasters
Definition: librtcore.h:2414
double *** values
Definition: librtcore.h:2422
int value
Definition: genraster.py:61
Here is the caller graph for this function: