PostGIS  2.5.1dev-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 1861 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().

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