PostGIS  2.4.9dev-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 1914 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().

1917  {
1918  if (arg == NULL)
1919  return 0;
1920 
1921  if (
1922  arg->rasters != 2 ||
1923  arg->rows != 1 ||
1924  arg->columns != 1
1925  ) {
1926  elog(ERROR, "rtpg_union_range_callback: Invalid arguments passed to callback");
1927  return 0;
1928  }
1929 
1930  *value = 0;
1931  *nodata = 1;
1932 
1933  POSTGIS_RT_DEBUGF(4, "rast0: %f %d", arg->values[0][0][0], arg->nodata[0][0][0]);
1934  POSTGIS_RT_DEBUGF(4, "rast1: %f %d", arg->values[1][0][0], arg->nodata[1][0][0]);
1935 
1936  if (
1937  !arg->nodata[0][0][0] &&
1938  !arg->nodata[1][0][0]
1939  ) {
1940  *value = arg->values[1][0][0] - arg->values[0][0][0];
1941  *nodata = 0;
1942  }
1943 
1944  POSTGIS_RT_DEBUGF(4, "value, nodata = (%f, %d)", *value, *nodata);
1945 
1946  return 1;
1947 }
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:65
uint32_t columns
Definition: librtcore.h:2406
uint16_t rasters
Definition: librtcore.h:2402
double *** values
Definition: librtcore.h:2410
int value
Definition: genraster.py:61
Here is the caller graph for this function: