PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ rt_raster_iterator()

rt_errorstate rt_raster_iterator ( rt_iterator  itrset,
uint16_t  itrcount,
rt_extenttype  extenttype,
rt_raster  customextent,
rt_pixtype  pixtype,
uint8_t  hasnodata,
double  nodataval,
uint16_t  distancex,
uint16_t  distancey,
rt_mask  mask,
void *  userarg,
int(*)(rt_iterator_arg arg, void *userarg, double *value, int *nodata)  callback,
rt_raster rtnraster 
)

n-raster iterator.

The raster returned should be freed by the caller

Parameters
itrset: set of rt_iterator objects.
itrcount: number of objects in itrset.
extenttype: type of extent for the output raster.
customextent: raster specifying custom extent. is only used if extenttype is ET_CUSTOM.
pixtype: the desired pixel type of the output raster's band.
hasnodata: indicates if the band has nodata value
nodataval: the nodata value, will be appropriately truncated to fit the pixtype size.
distancex: the number of pixels around the specified pixel along the X axis
distancey: the number of pixels around the specified pixel along the Y axis
mask: the object of mask
userarg: pointer to any argument that is passed as-is to callback.
callback: callback function for actual processing of pixel values.
*rtnraster: return one band raster from iterator process

The callback function must have the following signature.

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

The callback function must return zero (error) or non-zero (success) indicating whether the function ran successfully. The parameters passed to the callback function are as follows.

  • rt_iterator_arg arg: struct containing pixel values, NODATA flags and metadata
  • void *userarg: NULL or calling function provides to rt_raster_iterator() for use by callback function
  • double *value: value of pixel to be burned by rt_raster_iterator()
  • int *nodata: flag (0 or 1) indicating that pixel to be burned is NODATA
Returns
ES_NONE on success, ES_ERROR on error

Definition at line 823 of file rt_mapalgebra.c.

838  {
839  /* output raster */
840  rt_raster rtnrast = NULL;
841  /* output raster's band */
842  rt_band rtnband = NULL;
843 
844  /* working raster */
845  rt_raster rast = NULL;
846 
847  _rti_iterator_arg _param = NULL;
848  int allnull = 0;
849  int allempty = 0;
850  int aligned = 0;
851  double offset[4] = {0.};
852  rt_pixel npixels;
853 
854  int i = 0;
855  int status = 0;
856  int inextent = 0;
857  int x = 0;
858  int y = 0;
859  int _x = 0;
860  int _y = 0;
861 
862  int _width = 0;
863  int _height = 0;
864 
865  double minval;
866  double value;
867  int isnodata;
868  int nodata;
869 
870  RASTER_DEBUG(3, "Starting...");
871 
872  assert(itrset != NULL && itrcount > 0);
873  assert(rtnraster != NULL);
874 
875  /* init rtnraster to NULL */
876  *rtnraster = NULL;
877 
878  /* check that callback function is not NULL */
879  if (callback == NULL) {
880  rterror("rt_raster_iterator: Callback function not provided");
881  return ES_ERROR;
882  }
883 
884  /* check that custom extent is provided if extenttype = ET_CUSTOM */
885  if (extenttype == ET_CUSTOM && rt_raster_is_empty(customextent)) {
886  rterror("rt_raster_iterator: Custom extent cannot be empty if extent type is ET_CUSTOM");
887  return ES_ERROR;
888  }
889 
890  /* check that pixtype != PT_END */
891  if (pixtype == PT_END) {
892  rterror("rt_raster_iterator: Pixel type cannot be PT_END");
893  return ES_ERROR;
894  }
895 
896  /* initialize _param */
897  if ((_param = _rti_iterator_arg_init()) == NULL) {
898  rterror("rt_raster_iterator: Could not initialize internal variables");
899  return ES_ERROR;
900  }
901 
902  /* fill _param */
903  if (!_rti_iterator_arg_populate(_param, itrset, itrcount, distancex, distancey, &allnull, &allempty)) {
904  rterror("rt_raster_iterator: Could not populate for internal variables");
906  return ES_ERROR;
907  }
908 
909  /* shortcut if all null, return NULL */
910  if (allnull == itrcount) {
911  RASTER_DEBUG(3, "all rasters are NULL, returning NULL");
912 
914 
915  return ES_NONE;
916  }
917  /* shortcut if all empty, return empty raster */
918  else if (allempty == itrcount) {
919  RASTER_DEBUG(3, "all rasters are empty, returning empty raster");
920 
922 
923  rtnrast = rt_raster_new(0, 0);
924  if (rtnrast == NULL) {
925  rterror("rt_raster_iterator: Could not create empty raster");
926  return ES_ERROR;
927  }
928  rt_raster_set_scale(rtnrast, 0, 0);
929 
930  *rtnraster = rtnrast;
931  return ES_NONE;
932  }
933 
934  /* check that all rasters are aligned */
935  RASTER_DEBUG(3, "checking alignment of all rasters");
936  rast = NULL;
937 
938  /* find raster to use as reference */
939  /* use custom if provided */
940  if (extenttype == ET_CUSTOM) {
941  RASTER_DEBUG(4, "using custom extent as reference raster");
942  rast = customextent;
943  }
944  /* use first valid one in _param->raster */
945  else {
946  for (i = 0; i < itrcount; i++) {
947  if (!_param->isempty[i]) {
948  RASTER_DEBUGF(4, "using raster at index %d as reference raster", i);
949  rast = _param->raster[i];
950  break;
951  }
952  }
953  }
954 
955  /* no rasters found, SHOULD NEVER BE HERE! */
956  if (rast == NULL) {
957  rterror("rt_raster_iterator: Could not find reference raster to use for alignment tests");
958 
960 
961  return ES_ERROR;
962  }
963 
964  do {
965  aligned = 1;
966 
967  /* check custom first if set. also skip if rasters are the same */
968  if (extenttype == ET_CUSTOM && rast != customextent) {
969  if (rt_raster_same_alignment(rast, customextent, &aligned, NULL) != ES_NONE) {
970  rterror("rt_raster_iterator: Could not test for alignment between reference raster and custom extent");
971 
973 
974  return ES_ERROR;
975  }
976 
977  RASTER_DEBUGF(5, "custom extent alignment: %d", aligned);
978  if (!aligned)
979  break;
980  }
981 
982  for (i = 0; i < itrcount; i++) {
983  /* skip NULL rasters and if rasters are the same */
984  if (_param->isempty[i] || rast == _param->raster[i])
985  continue;
986 
987  if (rt_raster_same_alignment(rast, _param->raster[i], &aligned, NULL) != ES_NONE) {
988  rterror("rt_raster_iterator: Could not test for alignment between reference raster and raster %d", i);
989 
991 
992  return ES_ERROR;
993  }
994  RASTER_DEBUGF(5, "raster at index %d alignment: %d", i, aligned);
995 
996  /* abort checking since a raster isn't aligned */
997  if (!aligned)
998  break;
999  }
1000  }
1001  while (0);
1002 
1003  /* not aligned, error */
1004  if (!aligned) {
1005  rterror("rt_raster_iterator: The set of rasters provided (custom extent included, if appropriate) do not have the same alignment");
1006 
1007  _rti_iterator_arg_destroy(_param);
1008 
1009  return ES_ERROR;
1010  }
1011 
1012  /* use extenttype to build output raster (no bands though) */
1013  i = -1;
1014  switch (extenttype) {
1015  case ET_INTERSECTION:
1016  case ET_UNION:
1017  /* make copy of first "real" raster */
1018  rtnrast = rtalloc(sizeof(struct rt_raster_t));
1019  if (rtnrast == NULL) {
1020  rterror("rt_raster_iterator: Could not allocate memory for output raster");
1021 
1022  _rti_iterator_arg_destroy(_param);
1023 
1024  return ES_ERROR;
1025  }
1026 
1027  for (i = 0; i < itrcount; i++) {
1028  if (!_param->isempty[i]) {
1029  memcpy(rtnrast, _param->raster[i], sizeof(struct rt_raster_t));
1030  break;
1031  }
1032  }
1033  rtnrast->numBands = 0;
1034  rtnrast->bands = NULL;
1035 
1036  /* get extent of output raster */
1037  rast = NULL;
1038  for (i = i + 1; i < itrcount; i++) {
1039  if (_param->isempty[i])
1040  continue;
1041 
1042  status = rt_raster_from_two_rasters(rtnrast, _param->raster[i], extenttype, &rast, NULL);
1043  rtdealloc(rtnrast);
1044 
1045  if (rast == NULL || status != ES_NONE) {
1046  rterror("rt_raster_iterator: Could not compute %s extent of rasters",
1047  extenttype == ET_UNION ? "union" : "intersection"
1048  );
1049 
1050  _rti_iterator_arg_destroy(_param);
1051 
1052  return ES_ERROR;
1053  }
1054  else if (rt_raster_is_empty(rast)) {
1055  rtinfo("rt_raster_iterator: Computed raster for %s extent is empty",
1056  extenttype == ET_UNION ? "union" : "intersection"
1057  );
1058 
1059  _rti_iterator_arg_destroy(_param);
1060 
1061  *rtnraster = rast;
1062  return ES_NONE;
1063  }
1064 
1065  rtnrast = rast;
1066  rast = NULL;
1067  }
1068 
1069  break;
1070  /*
1071  first, second and last have similar checks
1072  and continue into custom
1073  */
1074  case ET_FIRST:
1075  i = 0;
1076  /* FALLTHROUGH */
1077  case ET_SECOND:
1078  if (i < 0) {
1079  if (itrcount < 2)
1080  i = 0;
1081  else
1082  i = 1;
1083  }
1084  /* FALLTHROUGH */
1085  case ET_LAST:
1086  if (i < 0) i = itrcount - 1;
1087 
1088  /* input raster is null, return NULL */
1089  if (_param->raster[i] == NULL) {
1090  RASTER_DEBUGF(3, "returning NULL as %s raster is NULL and extent type is ET_%s",
1091  (i == 0 ? "first" : (i == 1 ? "second" : "last")),
1092  (i == 0 ? "FIRST" : (i == 1 ? "SECOND" : "LAST"))
1093  );
1094 
1095  _rti_iterator_arg_destroy(_param);
1096 
1097  return ES_NONE;
1098  }
1099  /* input raster is empty, return empty raster */
1100  else if (_param->isempty[i]) {
1101  RASTER_DEBUGF(3, "returning empty raster as %s raster is empty and extent type is ET_%s",
1102  (i == 0 ? "first" : (i == 1 ? "second" : "last")),
1103  (i == 0 ? "FIRST" : (i == 1 ? "SECOND" : "LAST"))
1104  );
1105 
1106  _rti_iterator_arg_destroy(_param);
1107 
1108  rtnrast = rt_raster_new(0, 0);
1109  if (rtnrast == NULL) {
1110  rterror("rt_raster_iterator: Could not create empty raster");
1111  return ES_ERROR;
1112  }
1113  rt_raster_set_scale(rtnrast, 0, 0);
1114 
1115  *rtnraster = rtnrast;
1116  return ES_NONE;
1117  }
1118  /* FALLTHROUGH */
1119  /* copy the custom extent raster */
1120  case ET_CUSTOM:
1121  rtnrast = rtalloc(sizeof(struct rt_raster_t));
1122  if (rtnrast == NULL) {
1123  rterror("rt_raster_iterator: Could not allocate memory for output raster");
1124 
1125  _rti_iterator_arg_destroy(_param);
1126 
1127  return ES_ERROR;
1128  }
1129 
1130  switch (extenttype) {
1131  case ET_CUSTOM:
1132  memcpy(rtnrast, customextent, sizeof(struct rt_raster_t));
1133  break;
1134  /* first, second, last */
1135  default:
1136  memcpy(rtnrast, _param->raster[i], sizeof(struct rt_raster_t));
1137  break;
1138  }
1139  rtnrast->numBands = 0;
1140  rtnrast->bands = NULL;
1141  break;
1142  }
1143 
1144  _width = rt_raster_get_width(rtnrast);
1145  _height = rt_raster_get_height(rtnrast);
1146 
1147  RASTER_DEBUGF(4, "rtnrast (width, height, ulx, uly, scalex, scaley, skewx, skewy, srid) = (%d, %d, %f, %f, %f, %f, %f, %f, %d)",
1148  _width,
1149  _height,
1150  rt_raster_get_x_offset(rtnrast),
1151  rt_raster_get_y_offset(rtnrast),
1152  rt_raster_get_x_scale(rtnrast),
1153  rt_raster_get_y_scale(rtnrast),
1154  rt_raster_get_x_skew(rtnrast),
1155  rt_raster_get_y_skew(rtnrast),
1156  rt_raster_get_srid(rtnrast)
1157  );
1158 
1159  /* init values and NODATA for use with empty rasters */
1160  if (!_rti_iterator_arg_empty_init(_param)) {
1161  rterror("rt_raster_iterator: Could not initialize empty values and NODATA");
1162 
1163  _rti_iterator_arg_destroy(_param);
1164  rt_raster_destroy(rtnrast);
1165 
1166  return ES_ERROR;
1167  }
1168 
1169  /* create output band */
1171  rtnrast,
1172  pixtype,
1173  nodataval,
1174  hasnodata, nodataval,
1175  0
1176  ) < 0) {
1177  rterror("rt_raster_iterator: Could not add new band to output raster");
1178 
1179  _rti_iterator_arg_destroy(_param);
1180  rt_raster_destroy(rtnrast);
1181 
1182  return ES_ERROR;
1183  }
1184 
1185  /* get output band */
1186  rtnband = rt_raster_get_band(rtnrast, 0);
1187  if (rtnband == NULL) {
1188  rterror("rt_raster_iterator: Could not get new band from output raster");
1189 
1190  _rti_iterator_arg_destroy(_param);
1191  rt_raster_destroy(rtnrast);
1192 
1193  return ES_ERROR;
1194  }
1195 
1196  /* output band's minimum value */
1197  minval = rt_band_get_min_value(rtnband);
1198 
1199  /* initialize argument for callback function */
1200  if (!_rti_iterator_arg_callback_init(_param)) {
1201  rterror("rt_raster_iterator: Could not initialize callback function argument");
1202 
1203  _rti_iterator_arg_destroy(_param);
1204  rt_band_destroy(rtnband);
1205  rt_raster_destroy(rtnrast);
1206 
1207  return ES_ERROR;
1208  }
1209 
1210  /* fill _param->offset */
1211  for (i = 0; i < itrcount; i++) {
1212  if (_param->isempty[i])
1213  continue;
1214 
1215  status = rt_raster_from_two_rasters(rtnrast, _param->raster[i], ET_FIRST, &rast, offset);
1216  rtdealloc(rast);
1217  if (status != ES_NONE) {
1218  rterror("rt_raster_iterator: Could not compute raster offsets");
1219 
1220  _rti_iterator_arg_destroy(_param);
1221  rt_band_destroy(rtnband);
1222  rt_raster_destroy(rtnrast);
1223 
1224  return ES_ERROR;
1225  }
1226 
1227  _param->offset[i][0] = offset[2];
1228  _param->offset[i][1] = offset[3];
1229  RASTER_DEBUGF(4, "rast %d offset: %f %f", i, offset[2], offset[3]);
1230  }
1231 
1232  /* loop over each pixel (POI) of output raster */
1233  /* _x,_y are for output raster */
1234  /* x,y are for input raster */
1235  for (_y = 0; _y < _height; _y++) {
1236  for (_x = 0; _x < _width; _x++) {
1237  RASTER_DEBUGF(4, "iterating output pixel (x, y) = (%d, %d)", _x, _y);
1238  _param->arg->dst_pixel[0] = _x;
1239  _param->arg->dst_pixel[1] = _y;
1240 
1241  /* loop through each input raster */
1242  for (i = 0; i < itrcount; i++) {
1243  RASTER_DEBUGF(4, "raster %d", i);
1244 
1245  /*
1246  empty raster
1247  OR band does not exist and flag set to use NODATA
1248  OR band is NODATA
1249  */
1250  if (
1251  _param->isempty[i] ||
1252  (_param->band.rtband[i] == NULL && itrset[i].nbnodata) ||
1253  _param->band.isnodata[i]
1254  ) {
1255  RASTER_DEBUG(4, "empty raster, band does not exist or band is NODATA. using empty values and NODATA");
1256 
1257  x = _x;
1258  y = _y;
1259 
1260  _param->arg->values[i] = _param->empty.values;
1261  _param->arg->nodata[i] = _param->empty.nodata;
1262 
1263  continue;
1264  }
1265 
1266  /* input raster's X,Y */
1267  x = _x - (int) _param->offset[i][0];
1268  y = _y - (int) _param->offset[i][1];
1269  RASTER_DEBUGF(4, "source pixel (x, y) = (%d, %d)", x, y);
1270 
1271  _param->arg->src_pixel[i][0] = x;
1272  _param->arg->src_pixel[i][1] = y;
1273 
1274  /* neighborhood */
1275  npixels = NULL;
1276  status = 0;
1277  if (distancex > 0 && distancey > 0) {
1278  RASTER_DEBUG(4, "getting neighborhood");
1279 
1280  status = rt_band_get_nearest_pixel(
1281  _param->band.rtband[i],
1282  x, y,
1283  distancex, distancey,
1284  1,
1285  &npixels
1286  );
1287  if (status < 0) {
1288  rterror("rt_raster_iterator: Could not get pixel neighborhood");
1289 
1290  _rti_iterator_arg_destroy(_param);
1291  rt_band_destroy(rtnband);
1292  rt_raster_destroy(rtnrast);
1293 
1294  return ES_ERROR;
1295  }
1296  }
1297 
1298  /* get value of POI */
1299  /* get pixel's value */
1300  if (
1301  (x >= 0 && x < _param->width[i]) &&
1302  (y >= 0 && y < _param->height[i])
1303  ) {
1304  RASTER_DEBUG(4, "getting value of POI");
1305  if (rt_band_get_pixel(
1306  _param->band.rtband[i],
1307  x, y,
1308  &value,
1309  &isnodata
1310  ) != ES_NONE) {
1311  rterror("rt_raster_iterator: Could not get the pixel value of band");
1312 
1313  _rti_iterator_arg_destroy(_param);
1314  rt_band_destroy(rtnband);
1315  rt_raster_destroy(rtnrast);
1316 
1317  return ES_ERROR;
1318  }
1319  inextent = 1;
1320  }
1321  /* outside band extent, set to NODATA */
1322  else {
1323  RASTER_DEBUG(4, "Outside band extent, setting value to NODATA");
1324  /* has NODATA, use NODATA */
1325  if (_param->band.hasnodata[i])
1326  value = _param->band.nodataval[i];
1327  /* no NODATA, use min possible value */
1328  else
1329  value = _param->band.minval[i];
1330 
1331  inextent = 0;
1332  isnodata = 1;
1333  }
1334 
1335  /* add pixel to neighborhood */
1336  status++;
1337  if (status > 1)
1338  npixels = (rt_pixel) rtrealloc(npixels, sizeof(struct rt_pixel_t) * status);
1339  else
1340  npixels = (rt_pixel) rtalloc(sizeof(struct rt_pixel_t));
1341 
1342  if (npixels == NULL) {
1343  rterror("rt_raster_iterator: Could not reallocate memory for neighborhood");
1344 
1345  _rti_iterator_arg_destroy(_param);
1346  rt_band_destroy(rtnband);
1347  rt_raster_destroy(rtnrast);
1348 
1349  return ES_ERROR;
1350  }
1351 
1352  npixels[status - 1].x = x;
1353  npixels[status - 1].y = y;
1354  npixels[status - 1].nodata = 1;
1355  npixels[status - 1].value = value;
1356 
1357  /* set nodata flag */
1358  if ((!_param->band.hasnodata[i] && inextent) || !isnodata) {
1359  npixels[status - 1].nodata = 0;
1360  }
1361  RASTER_DEBUGF(4, "value, nodata: %f, %d", value, npixels[status - 1].nodata);
1362 
1363  /* convert set of rt_pixel to 2D array */
1364  status = rt_pixel_set_to_array(
1365  npixels, status, mask,
1366  x, y,
1367  distancex, distancey,
1368  &(_param->arg->values[i]),
1369  &(_param->arg->nodata[i]),
1370  NULL, NULL
1371  );
1372  rtdealloc(npixels);
1373  if (status != ES_NONE) {
1374  rterror("rt_raster_iterator: Could not create 2D array of neighborhood");
1375 
1376  _rti_iterator_arg_destroy(_param);
1377  rt_band_destroy(rtnband);
1378  rt_raster_destroy(rtnrast);
1379 
1380  return ES_ERROR;
1381  }
1382  }
1383 
1384  /* callback */
1385  RASTER_DEBUG(4, "calling callback function");
1386  value = 0;
1387  nodata = 0;
1388  status = callback(_param->arg, userarg, &value, &nodata);
1389 
1390  /* free memory from callback */
1392 
1393  /* handle callback status */
1394  if (status == 0) {
1395  rterror("rt_raster_iterator: Callback function returned an error");
1396 
1397  _rti_iterator_arg_destroy(_param);
1398  rt_band_destroy(rtnband);
1399  rt_raster_destroy(rtnrast);
1400 
1401  return ES_ERROR;
1402  }
1403 
1404  /* burn value to pixel */
1405  status = 0;
1406  if (!nodata) {
1407  status = rt_band_set_pixel(rtnband, _x, _y, value, NULL);
1408  RASTER_DEBUGF(4, "burning pixel (%d, %d) with value: %f", _x, _y, value);
1409  }
1410  else if (!hasnodata) {
1411  status = rt_band_set_pixel(rtnband, _x, _y, minval, NULL);
1412  RASTER_DEBUGF(4, "burning pixel (%d, %d) with minval: %f", _x, _y, minval);
1413  }
1414  else {
1415  RASTER_DEBUGF(4, "NOT burning pixel (%d, %d)", _x, _y);
1416  }
1417  if (status != ES_NONE) {
1418  rterror("rt_raster_iterator: Could not set pixel value");
1419 
1420  _rti_iterator_arg_destroy(_param);
1421  rt_band_destroy(rtnband);
1422  rt_raster_destroy(rtnrast);
1423 
1424  return ES_ERROR;
1425  }
1426  }
1427  }
1428 
1429  /* lots of cleanup */
1430  _rti_iterator_arg_destroy(_param);
1431 
1432  *rtnraster = rtnrast;
1433  return ES_NONE;
1434 }
void rterror(const char *fmt,...) __attribute__((format(printf
Wrappers used for reporting errors and info.
void * rtalloc(size_t size)
Wrappers used for managing memory.
Definition: rt_context.c:191
#define RASTER_DEBUG(level, msg)
Definition: librtcore.h:302
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
Definition: rt_raster.c:360
#define RASTER_DEBUGF(level, msg,...)
Definition: librtcore.h:306
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
Definition: rt_raster.c:185
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
Definition: rt_raster.c:217
int rt_raster_generate_new_band(rt_raster raster, rt_pixtype pixtype, double initialvalue, uint32_t hasnodata, double nodatavalue, int index)
Generate a new inline band and add it to a raster.
Definition: rt_raster.c:489
void void rtinfo(const char *fmt,...) __attribute__((format(printf
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_raster.c:141
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
Definition: rt_band.c:1527
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:86
@ PT_END
Definition: librtcore.h:199
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:52
struct rt_pixel_t * rt_pixel
Definition: librtcore.h:148
double rt_raster_get_x_scale(rt_raster raster)
Get scale X in projection units.
Definition: rt_raster.c:154
double rt_band_get_min_value(rt_band band)
Returns the minimal possible value for the band according to the pixel type.
Definition: rt_band.c:2053
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
Definition: rt_band.c:1125
@ ES_NONE
Definition: librtcore.h:182
@ ES_ERROR
Definition: librtcore.h:183
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_band.c:491
void * rtrealloc(void *mem, size_t size)
Definition: rt_context.c:199
uint16_t rt_raster_get_height(rt_raster raster)
Definition: rt_raster.c:133
@ ET_CUSTOM
Definition: librtcore.h:208
@ ET_LAST
Definition: librtcore.h:207
@ ET_INTERSECTION
Definition: librtcore.h:203
@ ET_UNION
Definition: librtcore.h:204
@ ET_SECOND
Definition: librtcore.h:206
@ ET_FIRST
Definition: librtcore.h:205
rt_errorstate rt_pixel_set_to_array(rt_pixel npixel, uint32_t count, rt_mask mask, int x, int y, uint16_t distancex, uint16_t distancey, double ***value, int ***nodata, int *dimx, int *dimy)
Definition: rt_pixel.c:288
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_raster.c:125
uint32_t rt_band_get_nearest_pixel(rt_band band, int x, int y, uint16_t distancex, uint16_t distancey, int exclude_nodata_value, rt_pixel *npixels)
Get nearest pixel(s) with value (not NODATA) to specified pixel.
Definition: rt_band.c:1680
void rtdealloc(void *mem)
Definition: rt_context.c:206
rt_errorstate rt_raster_from_two_rasters(rt_raster rast1, rt_raster rast2, rt_extenttype extenttype, rt_raster *rtnraster, double *offset)
Definition: rt_raster.c:3348
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
Definition: rt_raster.c:163
rt_errorstate rt_raster_same_alignment(rt_raster rast1, rt_raster rast2, int *aligned, char **reason)
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
Definition: rt_raster.c:194
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.
Definition: rt_raster.c:226
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
Definition: rt_raster.c:1240
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:385
int value
Definition: genraster.py:62
static int _rti_iterator_arg_callback_init(_rti_iterator_arg _param)
static int _rti_iterator_arg_empty_init(_rti_iterator_arg _param)
static _rti_iterator_arg _rti_iterator_arg_init()
static int _rti_iterator_arg_populate(_rti_iterator_arg _param, rt_iterator itrset, uint16_t itrcount, uint16_t distancex, uint16_t distancey, int *allnull, int *allempty)
static void _rti_iterator_arg_callback_clean(_rti_iterator_arg _param)
static void _rti_iterator_arg_destroy(_rti_iterator_arg _param)
struct _rti_iterator_arg_t::@16 band
struct _rti_iterator_arg_t::@19 empty
rt_iterator_arg arg
double *** values
Definition: librtcore.h:2663
double value
Definition: librtcore.h:2528
uint8_t nodata
Definition: librtcore.h:2527
rt_band * bands
Definition: librtcore.h:2493
uint16_t numBands
Definition: librtcore.h:2480

References _rti_iterator_arg_callback_clean(), _rti_iterator_arg_callback_init(), _rti_iterator_arg_destroy(), _rti_iterator_arg_empty_init(), _rti_iterator_arg_init(), _rti_iterator_arg_populate(), _rti_iterator_arg_t::arg, _rti_iterator_arg_t::band, rt_raster_t::bands, rt_iterator_arg_t::dst_pixel, _rti_iterator_arg_t::empty, ES_ERROR, ES_NONE, ET_CUSTOM, ET_FIRST, ET_INTERSECTION, ET_LAST, ET_SECOND, ET_UNION, _rti_iterator_arg_t::hasnodata, _rti_iterator_arg_t::isempty, _rti_iterator_arg_t::isnodata, _rti_iterator_arg_t::minval, rt_iterator_t::nbnodata, rt_pixel_t::nodata, rt_iterator_arg_t::nodata, _rti_iterator_arg_t::nodata, _rti_iterator_arg_t::nodataval, rt_raster_t::numBands, _rti_iterator_arg_t::offset, PT_END, rtpixdump::rast, _rti_iterator_arg_t::raster, RASTER_DEBUG, RASTER_DEBUGF, rt_band_destroy(), rt_band_get_min_value(), rt_band_get_nearest_pixel(), rt_band_get_pixel(), rt_band_set_pixel(), rt_pixel_set_to_array(), rt_raster_destroy(), rt_raster_from_two_rasters(), rt_raster_generate_new_band(), rt_raster_get_band(), rt_raster_get_height(), rt_raster_get_srid(), rt_raster_get_width(), rt_raster_get_x_offset(), rt_raster_get_x_scale(), rt_raster_get_x_skew(), rt_raster_get_y_offset(), rt_raster_get_y_scale(), rt_raster_get_y_skew(), rt_raster_is_empty(), rt_raster_new(), rt_raster_same_alignment(), rt_raster_set_scale(), rtalloc(), _rti_iterator_arg_t::rtband, rtdealloc(), rterror(), rtinfo(), rtrealloc(), rt_iterator_arg_t::src_pixel, rt_pixel_t::value, genraster::value, rt_iterator_arg_t::values, _rti_iterator_arg_t::values, rt_pixel_t::x, pixval::x, rt_pixel_t::y, and pixval::y.

Referenced by RASTER_nMapAlgebra(), RASTER_nMapAlgebraExpr(), RASTER_setPixelValuesGeomval(), RASTER_union_finalfn(), RASTER_union_transfn(), and test_raster_iterator().

Here is the call graph for this function:
Here is the caller graph for this function: