PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ RASTER_tile()

Datum RASTER_tile ( PG_FUNCTION_ARGS  )

Definition at line 984 of file rtpg_create.c.

References ovdump::band, ES_NONE, FALSE, window::gt, pixval::nband, PG_FUNCTION_INFO_V1(), POSTGIS_RT_DEBUG, POSTGIS_RT_DEBUGF, PT_END, rtrowdump::raster, RASTER_band(), rt_band_destroy(), rt_band_get_ext_band_num(), rt_band_get_ext_path(), rt_band_get_hasnodata_flag(), rt_band_get_isnodata_flag(), rt_band_get_min_value(), rt_band_get_nodata(), rt_band_get_pixel_line(), rt_band_get_pixtype(), rt_band_is_offline(), rt_band_new_offline(), rt_band_set_isnodata_flag(), rt_band_set_pixel_line(), rt_raster_add_band(), rt_raster_cell_to_geopoint(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_generate_new_band(), rt_raster_get_band(), rt_raster_get_geotransform_matrix(), rt_raster_get_height(), rt_raster_get_num_bands(), rt_raster_get_srid(), rt_raster_get_width(), rt_raster_has_band(), rt_raster_new(), rt_raster_serialize(), rt_raster_set_geotransform_matrix(), rt_raster_set_offsets(), rt_raster_set_srid(), and rt_raster_serialized_t::size.

Referenced by RASTER_copyBand().

985 {
986  FuncCallContext *funcctx;
987  int call_cntr;
988  int max_calls;
989  int i = 0;
990  int j = 0;
991 
992  struct tile_arg_t {
993 
994  struct {
996  double gt[6];
997  int srid;
998  int width;
999  int height;
1000  } raster;
1001 
1002  struct {
1003  int width;
1004  int height;
1005 
1006  int nx;
1007  int ny;
1008  } tile;
1009 
1010  int numbands;
1011  int *nbands;
1012 
1013  struct {
1014  int pad;
1015  double hasnodata;
1016  double nodataval;
1017  } pad;
1018  };
1019  struct tile_arg_t *arg1 = NULL;
1020  struct tile_arg_t *arg2 = NULL;
1021 
1022  if (SRF_IS_FIRSTCALL()) {
1023  MemoryContext oldcontext;
1024  rt_pgraster *pgraster = NULL;
1025  int numbands;
1026 
1027  ArrayType *array;
1028  Oid etype;
1029  Datum *e;
1030  bool *nulls;
1031 
1032  int16 typlen;
1033  bool typbyval;
1034  char typalign;
1035 
1036  POSTGIS_RT_DEBUG(2, "RASTER_tile: first call");
1037 
1038  /* create a function context for cross-call persistence */
1039  funcctx = SRF_FIRSTCALL_INIT();
1040 
1041  /* switch to memory context appropriate for multiple function calls */
1042  oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
1043 
1044  /* Get input arguments */
1045  if (PG_ARGISNULL(0)) {
1046  MemoryContextSwitchTo(oldcontext);
1047  SRF_RETURN_DONE(funcctx);
1048  }
1049 
1050  /* allocate arg1 */
1051  arg1 = palloc(sizeof(struct tile_arg_t));
1052  if (arg1 == NULL) {
1053  MemoryContextSwitchTo(oldcontext);
1054  elog(ERROR, "RASTER_tile: Could not allocate memory for arguments");
1055  SRF_RETURN_DONE(funcctx);
1056  }
1057 
1058  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
1059  arg1->raster.raster = rt_raster_deserialize(pgraster, FALSE);
1060  if (!arg1->raster.raster) {
1061  ereport(ERROR, (
1062  errcode(ERRCODE_OUT_OF_MEMORY),
1063  errmsg("Could not deserialize raster")
1064  ));
1065  pfree(arg1);
1066  PG_FREE_IF_COPY(pgraster, 0);
1067  MemoryContextSwitchTo(oldcontext);
1068  SRF_RETURN_DONE(funcctx);
1069  }
1070 
1071  /* raster has bands */
1072  numbands = rt_raster_get_num_bands(arg1->raster.raster);
1073  /*
1074  if (!numbands) {
1075  elog(NOTICE, "Raster provided has no bands");
1076  rt_raster_destroy(arg1->raster.raster);
1077  pfree(arg1);
1078  PG_FREE_IF_COPY(pgraster, 0);
1079  MemoryContextSwitchTo(oldcontext);
1080  SRF_RETURN_DONE(funcctx);
1081  }
1082  */
1083 
1084  /* width (1) */
1085  if (PG_ARGISNULL(1)) {
1086  elog(NOTICE, "Width cannot be NULL. Returning NULL");
1087  rt_raster_destroy(arg1->raster.raster);
1088  pfree(arg1);
1089  PG_FREE_IF_COPY(pgraster, 0);
1090  MemoryContextSwitchTo(oldcontext);
1091  SRF_RETURN_DONE(funcctx);
1092  }
1093  arg1->tile.width = PG_GETARG_INT32(1);
1094  if (arg1->tile.width < 1) {
1095  elog(NOTICE, "Width must be greater than zero. Returning NULL");
1096  rt_raster_destroy(arg1->raster.raster);
1097  pfree(arg1);
1098  PG_FREE_IF_COPY(pgraster, 0);
1099  MemoryContextSwitchTo(oldcontext);
1100  SRF_RETURN_DONE(funcctx);
1101  }
1102 
1103  /* height (2) */
1104  if (PG_ARGISNULL(2)) {
1105  elog(NOTICE, "Height cannot be NULL. Returning NULL");
1106  rt_raster_destroy(arg1->raster.raster);
1107  pfree(arg1);
1108  PG_FREE_IF_COPY(pgraster, 0);
1109  MemoryContextSwitchTo(oldcontext);
1110  SRF_RETURN_DONE(funcctx);
1111  }
1112  arg1->tile.height = PG_GETARG_INT32(2);
1113  if (arg1->tile.height < 1) {
1114  elog(NOTICE, "Height must be greater than zero. Returning NULL");
1115  rt_raster_destroy(arg1->raster.raster);
1116  pfree(arg1);
1117  PG_FREE_IF_COPY(pgraster, 0);
1118  MemoryContextSwitchTo(oldcontext);
1119  SRF_RETURN_DONE(funcctx);
1120  }
1121 
1122  /* nband, array (3) */
1123  if (numbands && !PG_ARGISNULL(3)) {
1124  array = PG_GETARG_ARRAYTYPE_P(3);
1125  etype = ARR_ELEMTYPE(array);
1126  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
1127 
1128  switch (etype) {
1129  case INT2OID:
1130  case INT4OID:
1131  break;
1132  default:
1133  rt_raster_destroy(arg1->raster.raster);
1134  pfree(arg1);
1135  PG_FREE_IF_COPY(pgraster, 0);
1136  MemoryContextSwitchTo(oldcontext);
1137  elog(ERROR, "RASTER_tile: Invalid data type for band indexes");
1138  SRF_RETURN_DONE(funcctx);
1139  break;
1140  }
1141 
1142  deconstruct_array(array, etype, typlen, typbyval, typalign, &e, &nulls, &(arg1->numbands));
1143 
1144  arg1->nbands = palloc(sizeof(int) * arg1->numbands);
1145  if (arg1->nbands == NULL) {
1146  rt_raster_destroy(arg1->raster.raster);
1147  pfree(arg1);
1148  PG_FREE_IF_COPY(pgraster, 0);
1149  MemoryContextSwitchTo(oldcontext);
1150  elog(ERROR, "RASTER_tile: Could not allocate memory for band indexes");
1151  SRF_RETURN_DONE(funcctx);
1152  }
1153 
1154  for (i = 0, j = 0; i < arg1->numbands; i++) {
1155  if (nulls[i]) continue;
1156 
1157  switch (etype) {
1158  case INT2OID:
1159  arg1->nbands[j] = DatumGetInt16(e[i]) - 1;
1160  break;
1161  case INT4OID:
1162  arg1->nbands[j] = DatumGetInt32(e[i]) - 1;
1163  break;
1164  }
1165 
1166  j++;
1167  }
1168 
1169  if (j < arg1->numbands) {
1170  arg1->nbands = repalloc(arg1->nbands, sizeof(int) * j);
1171  if (arg1->nbands == NULL) {
1172  rt_raster_destroy(arg1->raster.raster);
1173  pfree(arg1);
1174  PG_FREE_IF_COPY(pgraster, 0);
1175  MemoryContextSwitchTo(oldcontext);
1176  elog(ERROR, "RASTER_tile: Could not reallocate memory for band indexes");
1177  SRF_RETURN_DONE(funcctx);
1178  }
1179 
1180  arg1->numbands = j;
1181  }
1182 
1183  /* validate nbands */
1184  for (i = 0; i < arg1->numbands; i++) {
1185  if (!rt_raster_has_band(arg1->raster.raster, arg1->nbands[i])) {
1186  elog(NOTICE, "Band at index %d not found in raster", arg1->nbands[i] + 1);
1187  rt_raster_destroy(arg1->raster.raster);
1188  pfree(arg1->nbands);
1189  pfree(arg1);
1190  PG_FREE_IF_COPY(pgraster, 0);
1191  MemoryContextSwitchTo(oldcontext);
1192  SRF_RETURN_DONE(funcctx);
1193  }
1194  }
1195  }
1196  else {
1197  arg1->numbands = numbands;
1198 
1199  if (numbands) {
1200  arg1->nbands = palloc(sizeof(int) * arg1->numbands);
1201 
1202  if (arg1->nbands == NULL) {
1203  rt_raster_destroy(arg1->raster.raster);
1204  pfree(arg1);
1205  PG_FREE_IF_COPY(pgraster, 0);
1206  MemoryContextSwitchTo(oldcontext);
1207  elog(ERROR, "RASTER_dumpValues: Could not allocate memory for pixel values");
1208  SRF_RETURN_DONE(funcctx);
1209  }
1210 
1211  for (i = 0; i < arg1->numbands; i++) {
1212  arg1->nbands[i] = i;
1213  POSTGIS_RT_DEBUGF(4, "arg1->nbands[%d] = %d", arg1->nbands[i], i);
1214  }
1215  }
1216  }
1217 
1218  /* pad (4) and padnodata (5) */
1219  if (!PG_ARGISNULL(4)) {
1220  arg1->pad.pad = PG_GETARG_BOOL(4) ? 1 : 0;
1221 
1222  if (arg1->pad.pad && !PG_ARGISNULL(5)) {
1223  arg1->pad.hasnodata = 1;
1224  arg1->pad.nodataval = PG_GETARG_FLOAT8(5);
1225  }
1226  else {
1227  arg1->pad.hasnodata = 0;
1228  arg1->pad.nodataval = 0;
1229  }
1230  }
1231  else {
1232  arg1->pad.pad = 0;
1233  arg1->pad.hasnodata = 0;
1234  arg1->pad.nodataval = 0;
1235  }
1236 
1237  /* store some additional metadata */
1238  arg1->raster.srid = rt_raster_get_srid(arg1->raster.raster);
1239  arg1->raster.width = rt_raster_get_width(arg1->raster.raster);
1240  arg1->raster.height = rt_raster_get_height(arg1->raster.raster);
1241  rt_raster_get_geotransform_matrix(arg1->raster.raster, arg1->raster.gt);
1242 
1243  /* determine maximum number of tiles from raster */
1244  arg1->tile.nx = ceil(arg1->raster.width / (double) arg1->tile.width);
1245  arg1->tile.ny = ceil(arg1->raster.height / (double) arg1->tile.height);
1246  POSTGIS_RT_DEBUGF(4, "# of tiles (x, y) = (%d, %d)", arg1->tile.nx, arg1->tile.ny);
1247 
1248  /* Store needed information */
1249  funcctx->user_fctx = arg1;
1250 
1251  /* total number of tuples to be returned */
1252  funcctx->max_calls = (arg1->tile.nx * arg1->tile.ny);
1253 
1254  MemoryContextSwitchTo(oldcontext);
1255  }
1256 
1257  /* stuff done on every call of the function */
1258  funcctx = SRF_PERCALL_SETUP();
1259 
1260  call_cntr = funcctx->call_cntr;
1261  max_calls = funcctx->max_calls;
1262  arg2 = funcctx->user_fctx;
1263 
1264  /* do when there is more left to send */
1265  if (call_cntr < max_calls) {
1266  rt_pgraster *pgtile = NULL;
1267  rt_raster tile = NULL;
1268  rt_band _band = NULL;
1269  rt_band band = NULL;
1270  rt_pixtype pixtype = PT_END;
1271  int hasnodata = 0;
1272  double nodataval = 0;
1273  int width = 0;
1274  int height = 0;
1275 
1276  int k = 0;
1277  int tx = 0;
1278  int ty = 0;
1279  int rx = 0;
1280  int ry = 0;
1281  int ex = 0; /* edge tile on right */
1282  int ey = 0; /* edge tile on bottom */
1283  double ulx = 0;
1284  double uly = 0;
1285  uint16_t len = 0;
1286  void *vals = NULL;
1287  uint16_t nvals;
1288 
1289  POSTGIS_RT_DEBUGF(3, "call number %d", call_cntr);
1290 
1291  /*
1292  find offset based upon tile #
1293 
1294  0 1 2
1295  3 4 5
1296  6 7 8
1297  */
1298  ty = call_cntr / arg2->tile.nx;
1299  tx = call_cntr % arg2->tile.nx;
1300  POSTGIS_RT_DEBUGF(4, "tile (x, y) = (%d, %d)", tx, ty);
1301 
1302  /* edge tile? only important if padding is false */
1303  if (!arg2->pad.pad) {
1304  if (ty + 1 == arg2->tile.ny)
1305  ey = 1;
1306  if (tx + 1 == arg2->tile.nx)
1307  ex = 1;
1308  }
1309 
1310  /* upper-left of tile in raster coordinates */
1311  rx = tx * arg2->tile.width;
1312  ry = ty * arg2->tile.height;
1313  POSTGIS_RT_DEBUGF(4, "raster coordinates = %d, %d", rx, ry);
1314 
1315  /* determine tile width and height */
1316  /* default to user-defined */
1317  width = arg2->tile.width;
1318  height = arg2->tile.height;
1319 
1320  /* override user-defined if edge tile (only possible if padding is false */
1321  if (ex || ey) {
1322  /* right edge */
1323  if (ex)
1324  width = arg2->raster.width - rx;
1325  /* bottom edge */
1326  if (ey)
1327  height = arg2->raster.height - ry;
1328  }
1329 
1330  /* create empty raster */
1331  tile = rt_raster_new(width, height);
1332  rt_raster_set_geotransform_matrix(tile, arg2->raster.gt);
1333  rt_raster_set_srid(tile, arg2->raster.srid);
1334 
1335  /* upper-left of tile in spatial coordinates */
1336  if (rt_raster_cell_to_geopoint(arg2->raster.raster, rx, ry, &ulx, &uly, arg2->raster.gt) != ES_NONE) {
1337  rt_raster_destroy(tile);
1338  rt_raster_destroy(arg2->raster.raster);
1339  if (arg2->numbands) pfree(arg2->nbands);
1340  pfree(arg2);
1341  elog(ERROR, "RASTER_tile: Could not compute the coordinates of the upper-left corner of the output tile");
1342  SRF_RETURN_DONE(funcctx);
1343  }
1344  rt_raster_set_offsets(tile, ulx, uly);
1345  POSTGIS_RT_DEBUGF(4, "spatial coordinates = %f, %f", ulx, uly);
1346 
1347  /* compute length of pixel line to read */
1348  len = arg2->tile.width;
1349  if (rx + arg2->tile.width >= arg2->raster.width)
1350  len = arg2->raster.width - rx;
1351  POSTGIS_RT_DEBUGF(3, "read line len = %d", len);
1352 
1353  /* copy bands to tile */
1354  for (i = 0; i < arg2->numbands; i++) {
1355  POSTGIS_RT_DEBUGF(4, "copying band %d to tile %d", arg2->nbands[i], call_cntr);
1356 
1357  _band = rt_raster_get_band(arg2->raster.raster, arg2->nbands[i]);
1358  if (_band == NULL) {
1359  int nband = arg2->nbands[i] + 1;
1360  rt_raster_destroy(tile);
1361  rt_raster_destroy(arg2->raster.raster);
1362  if (arg2->numbands) pfree(arg2->nbands);
1363  pfree(arg2);
1364  elog(ERROR, "RASTER_tile: Could not get band %d from source raster", nband);
1365  SRF_RETURN_DONE(funcctx);
1366  }
1367 
1368  pixtype = rt_band_get_pixtype(_band);
1369  hasnodata = rt_band_get_hasnodata_flag(_band);
1370  if (hasnodata)
1371  rt_band_get_nodata(_band, &nodataval);
1372  else if (arg2->pad.pad && arg2->pad.hasnodata) {
1373  hasnodata = 1;
1374  nodataval = arg2->pad.nodataval;
1375  }
1376  else
1377  nodataval = rt_band_get_min_value(_band);
1378 
1379  /* inline band */
1380  if (!rt_band_is_offline(_band)) {
1381  if (rt_raster_generate_new_band(tile, pixtype, nodataval, hasnodata, nodataval, i) < 0) {
1382  rt_raster_destroy(tile);
1383  rt_raster_destroy(arg2->raster.raster);
1384  pfree(arg2->nbands);
1385  pfree(arg2);
1386  elog(ERROR, "RASTER_tile: Could not add new band to output tile");
1387  SRF_RETURN_DONE(funcctx);
1388  }
1389  band = rt_raster_get_band(tile, i);
1390  if (band == NULL) {
1391  rt_raster_destroy(tile);
1392  rt_raster_destroy(arg2->raster.raster);
1393  if (arg2->numbands) pfree(arg2->nbands);
1394  pfree(arg2);
1395  elog(ERROR, "RASTER_tile: Could not get newly added band from output tile");
1396  SRF_RETURN_DONE(funcctx);
1397  }
1398 
1399  /* if isnodata, set flag and continue */
1400  if (rt_band_get_isnodata_flag(_band)) {
1401  rt_band_set_isnodata_flag(band, 1);
1402  continue;
1403  }
1404 
1405  /* copy data */
1406  for (j = 0; j < arg2->tile.height; j++) {
1407  k = ry + j;
1408 
1409  if (k >= arg2->raster.height) {
1410  POSTGIS_RT_DEBUGF(4, "row %d is beyond extent of source raster. skipping", k);
1411  continue;
1412  }
1413 
1414  POSTGIS_RT_DEBUGF(4, "getting pixel line %d, %d for %d pixels", rx, k, len);
1415  if (rt_band_get_pixel_line(_band, rx, k, len, &vals, &nvals) != ES_NONE) {
1416  rt_raster_destroy(tile);
1417  rt_raster_destroy(arg2->raster.raster);
1418  if (arg2->numbands) pfree(arg2->nbands);
1419  pfree(arg2);
1420  elog(ERROR, "RASTER_tile: Could not get pixel line from source raster");
1421  SRF_RETURN_DONE(funcctx);
1422  }
1423 
1424  if (nvals && rt_band_set_pixel_line(band, 0, j, vals, nvals) != ES_NONE) {
1425  rt_raster_destroy(tile);
1426  rt_raster_destroy(arg2->raster.raster);
1427  if (arg2->numbands) pfree(arg2->nbands);
1428  pfree(arg2);
1429  elog(ERROR, "RASTER_tile: Could not set pixel line of output tile");
1430  SRF_RETURN_DONE(funcctx);
1431  }
1432  }
1433  }
1434  /* offline */
1435  else {
1436  uint8_t bandnum = 0;
1437  rt_band_get_ext_band_num(_band, &bandnum);
1438 
1439  band = rt_band_new_offline(
1440  width, height,
1441  pixtype,
1442  hasnodata, nodataval,
1443  bandnum, rt_band_get_ext_path(_band)
1444  );
1445 
1446  if (band == NULL) {
1447  rt_raster_destroy(tile);
1448  rt_raster_destroy(arg2->raster.raster);
1449  if (arg2->numbands) pfree(arg2->nbands);
1450  pfree(arg2);
1451  elog(ERROR, "RASTER_tile: Could not create new offline band for output tile");
1452  SRF_RETURN_DONE(funcctx);
1453  }
1454 
1455  if (rt_raster_add_band(tile, band, i) < 0) {
1456  rt_band_destroy(band);
1457  rt_raster_destroy(tile);
1458  rt_raster_destroy(arg2->raster.raster);
1459  if (arg2->numbands) pfree(arg2->nbands);
1460  pfree(arg2);
1461  elog(ERROR, "RASTER_tile: Could not add new offline band to output tile");
1462  SRF_RETURN_DONE(funcctx);
1463  }
1464  }
1465  }
1466 
1467  pgtile = rt_raster_serialize(tile);
1468  rt_raster_destroy(tile);
1469  if (!pgtile) {
1470  rt_raster_destroy(arg2->raster.raster);
1471  if (arg2->numbands) pfree(arg2->nbands);
1472  pfree(arg2);
1473  SRF_RETURN_DONE(funcctx);
1474  }
1475 
1476  SET_VARSIZE(pgtile, pgtile->size);
1477  SRF_RETURN_NEXT(funcctx, PointerGetDatum(pgtile));
1478  }
1479  /* do when there is no more left */
1480  else {
1481  rt_raster_destroy(arg2->raster.raster);
1482  if (arg2->numbands) pfree(arg2->nbands);
1483  pfree(arg2);
1484  SRF_RETURN_DONE(funcctx);
1485  }
1486 }
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_serialize.c:521
int rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
raster
Be careful!! Zeros function&#39;s input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
void rt_raster_set_geotransform_matrix(rt_raster raster, double *gt)
Set raster&#39;s geotransform using 6-element array.
Definition: rt_raster.c:727
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition: rt_raster.c:706
band
Definition: ovdump.py:57
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
Definition: rt_band.c:228
gt
Definition: window.py:77
rt_pixtype
Definition: librtcore.h:185
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_band.c:242
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rtpostgis.h:65
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
Definition: rt_band.c:1597
const char * rt_band_get_ext_path(rt_band band)
Return band&#39;s external path (only valid when rt_band_is_offline returns non-zero).
Definition: rt_band.c:265
rt_errorstate rt_raster_cell_to_geopoint(rt_raster raster, double xr, double yr, double *xw, double *yw, double *gt)
Convert an xr, yr raster point to an xw, yw point on map.
Definition: rt_raster.c:755
nband
Definition: pixval.py:52
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:485
rt_errorstate rt_band_get_pixel_line(rt_band band, int x, int y, uint16_t len, void **vals, uint16_t *nvals)
Get values of multiple pixels.
Definition: rt_band.c:1004
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_raster.c:199
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:381
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
Definition: rt_band.c:541
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_raster.c:1351
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster&#39;s SRID.
Definition: rt_raster.c:363
int32_t rt_raster_get_srid(rt_raster raster)
Get raster&#39;s SRID.
Definition: rt_raster.c:356
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
rt_errorstate rt_band_get_ext_band_num(rt_band band, uint8_t *bandnum)
Return bands&#39; external band number (only valid when rt_band_is_offline returns non-zero).
Definition: rt_band.c:278
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_raster.c:121
rt_errorstate rt_band_set_isnodata_flag(rt_band band, int flag)
Set isnodata flag value.
Definition: rt_band.c:562
#define FALSE
Definition: dbfopen.c:168
Struct definitions.
Definition: librtcore.h:2201
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:1612
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
Definition: rt_band.c:498
rt_errorstate rt_band_set_pixel_line(rt_band band, int x, int y, void *vals, uint32_t len)
Set values of multiple pixels.
Definition: rt_band.c:720
int rt_raster_add_band(rt_raster raster, rt_band band, int index)
Add band data to a raster.
Definition: rt_raster.c:405
int rt_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
Definition: rt_band.c:581
uint16_t rt_raster_get_height(rt_raster raster)
Definition: rt_raster.c:129
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rtpostgis.h:61
unsigned char uint8_t
Definition: uthash.h:79
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:717
rt_band rt_band_new_offline(uint16_t width, uint16_t height, rt_pixtype pixtype, uint32_t hasnodata, double nodataval, uint8_t bandNum, const char *path)
Create an out-db rt_band.
Definition: rt_band.c:119
Here is the call graph for this function:
Here is the caller graph for this function: