PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ RASTER_tile()

Datum RASTER_tile ( PG_FUNCTION_ARGS  )

Definition at line 937 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().

938 {
939  FuncCallContext *funcctx;
940  int call_cntr;
941  int max_calls;
942  int i = 0;
943  int j = 0;
944 
945  struct tile_arg_t {
946 
947  struct {
949  double gt[6];
950  int srid;
951  int width;
952  int height;
953  } raster;
954 
955  struct {
956  int width;
957  int height;
958 
959  int nx;
960  int ny;
961  } tile;
962 
963  int numbands;
964  int *nbands;
965 
966  struct {
967  int pad;
968  double hasnodata;
969  double nodataval;
970  } pad;
971  };
972  struct tile_arg_t *arg1 = NULL;
973  struct tile_arg_t *arg2 = NULL;
974 
975  if (SRF_IS_FIRSTCALL()) {
976  MemoryContext oldcontext;
977  rt_pgraster *pgraster = NULL;
978  int numbands;
979 
980  ArrayType *array;
981  Oid etype;
982  Datum *e;
983  bool *nulls;
984 
985  int16 typlen;
986  bool typbyval;
987  char typalign;
988 
989  POSTGIS_RT_DEBUG(2, "RASTER_tile: first call");
990 
991  /* create a function context for cross-call persistence */
992  funcctx = SRF_FIRSTCALL_INIT();
993 
994  /* switch to memory context appropriate for multiple function calls */
995  oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
996 
997  /* Get input arguments */
998  if (PG_ARGISNULL(0)) {
999  MemoryContextSwitchTo(oldcontext);
1000  SRF_RETURN_DONE(funcctx);
1001  }
1002 
1003  /* allocate arg1 */
1004  arg1 = palloc(sizeof(struct tile_arg_t));
1005  if (arg1 == NULL) {
1006  MemoryContextSwitchTo(oldcontext);
1007  elog(ERROR, "RASTER_tile: Could not allocate memory for arguments");
1008  SRF_RETURN_DONE(funcctx);
1009  }
1010 
1011  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
1012  arg1->raster.raster = rt_raster_deserialize(pgraster, FALSE);
1013  if (!arg1->raster.raster) {
1014  ereport(ERROR, (
1015  errcode(ERRCODE_OUT_OF_MEMORY),
1016  errmsg("Could not deserialize raster")
1017  ));
1018  pfree(arg1);
1019  PG_FREE_IF_COPY(pgraster, 0);
1020  MemoryContextSwitchTo(oldcontext);
1021  SRF_RETURN_DONE(funcctx);
1022  }
1023 
1024  /* raster has bands */
1025  numbands = rt_raster_get_num_bands(arg1->raster.raster);
1026  /*
1027  if (!numbands) {
1028  elog(NOTICE, "Raster provided has no bands");
1029  rt_raster_destroy(arg1->raster.raster);
1030  pfree(arg1);
1031  PG_FREE_IF_COPY(pgraster, 0);
1032  MemoryContextSwitchTo(oldcontext);
1033  SRF_RETURN_DONE(funcctx);
1034  }
1035  */
1036 
1037  /* width (1) */
1038  if (PG_ARGISNULL(1)) {
1039  elog(NOTICE, "Width cannot be NULL. Returning NULL");
1040  rt_raster_destroy(arg1->raster.raster);
1041  pfree(arg1);
1042  PG_FREE_IF_COPY(pgraster, 0);
1043  MemoryContextSwitchTo(oldcontext);
1044  SRF_RETURN_DONE(funcctx);
1045  }
1046  arg1->tile.width = PG_GETARG_INT32(1);
1047  if (arg1->tile.width < 1) {
1048  elog(NOTICE, "Width must be greater than zero. Returning NULL");
1049  rt_raster_destroy(arg1->raster.raster);
1050  pfree(arg1);
1051  PG_FREE_IF_COPY(pgraster, 0);
1052  MemoryContextSwitchTo(oldcontext);
1053  SRF_RETURN_DONE(funcctx);
1054  }
1055 
1056  /* height (2) */
1057  if (PG_ARGISNULL(2)) {
1058  elog(NOTICE, "Height cannot be NULL. Returning NULL");
1059  rt_raster_destroy(arg1->raster.raster);
1060  pfree(arg1);
1061  PG_FREE_IF_COPY(pgraster, 0);
1062  MemoryContextSwitchTo(oldcontext);
1063  SRF_RETURN_DONE(funcctx);
1064  }
1065  arg1->tile.height = PG_GETARG_INT32(2);
1066  if (arg1->tile.height < 1) {
1067  elog(NOTICE, "Height must be greater than zero. Returning NULL");
1068  rt_raster_destroy(arg1->raster.raster);
1069  pfree(arg1);
1070  PG_FREE_IF_COPY(pgraster, 0);
1071  MemoryContextSwitchTo(oldcontext);
1072  SRF_RETURN_DONE(funcctx);
1073  }
1074 
1075  /* nband, array (3) */
1076  if (numbands && !PG_ARGISNULL(3)) {
1077  array = PG_GETARG_ARRAYTYPE_P(3);
1078  etype = ARR_ELEMTYPE(array);
1079  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
1080 
1081  switch (etype) {
1082  case INT2OID:
1083  case INT4OID:
1084  break;
1085  default:
1086  rt_raster_destroy(arg1->raster.raster);
1087  pfree(arg1);
1088  PG_FREE_IF_COPY(pgraster, 0);
1089  MemoryContextSwitchTo(oldcontext);
1090  elog(ERROR, "RASTER_tile: Invalid data type for band indexes");
1091  SRF_RETURN_DONE(funcctx);
1092  break;
1093  }
1094 
1095  deconstruct_array(array, etype, typlen, typbyval, typalign, &e, &nulls, &(arg1->numbands));
1096 
1097  arg1->nbands = palloc(sizeof(int) * arg1->numbands);
1098  if (arg1->nbands == NULL) {
1099  rt_raster_destroy(arg1->raster.raster);
1100  pfree(arg1);
1101  PG_FREE_IF_COPY(pgraster, 0);
1102  MemoryContextSwitchTo(oldcontext);
1103  elog(ERROR, "RASTER_tile: Could not allocate memory for band indexes");
1104  SRF_RETURN_DONE(funcctx);
1105  }
1106 
1107  for (i = 0, j = 0; i < arg1->numbands; i++) {
1108  if (nulls[i]) continue;
1109 
1110  switch (etype) {
1111  case INT2OID:
1112  arg1->nbands[j] = DatumGetInt16(e[i]) - 1;
1113  break;
1114  case INT4OID:
1115  arg1->nbands[j] = DatumGetInt32(e[i]) - 1;
1116  break;
1117  }
1118 
1119  j++;
1120  }
1121 
1122  if (j < arg1->numbands) {
1123  arg1->nbands = repalloc(arg1->nbands, sizeof(int) * j);
1124  if (arg1->nbands == NULL) {
1125  rt_raster_destroy(arg1->raster.raster);
1126  pfree(arg1);
1127  PG_FREE_IF_COPY(pgraster, 0);
1128  MemoryContextSwitchTo(oldcontext);
1129  elog(ERROR, "RASTER_tile: Could not reallocate memory for band indexes");
1130  SRF_RETURN_DONE(funcctx);
1131  }
1132 
1133  arg1->numbands = j;
1134  }
1135 
1136  /* validate nbands */
1137  for (i = 0; i < arg1->numbands; i++) {
1138  if (!rt_raster_has_band(arg1->raster.raster, arg1->nbands[i])) {
1139  elog(NOTICE, "Band at index %d not found in raster", arg1->nbands[i] + 1);
1140  rt_raster_destroy(arg1->raster.raster);
1141  pfree(arg1->nbands);
1142  pfree(arg1);
1143  PG_FREE_IF_COPY(pgraster, 0);
1144  MemoryContextSwitchTo(oldcontext);
1145  SRF_RETURN_DONE(funcctx);
1146  }
1147  }
1148  }
1149  else {
1150  arg1->numbands = numbands;
1151 
1152  if (numbands) {
1153  arg1->nbands = palloc(sizeof(int) * arg1->numbands);
1154 
1155  if (arg1->nbands == NULL) {
1156  rt_raster_destroy(arg1->raster.raster);
1157  pfree(arg1);
1158  PG_FREE_IF_COPY(pgraster, 0);
1159  MemoryContextSwitchTo(oldcontext);
1160  elog(ERROR, "RASTER_dumpValues: Could not allocate memory for pixel values");
1161  SRF_RETURN_DONE(funcctx);
1162  }
1163 
1164  for (i = 0; i < arg1->numbands; i++) {
1165  arg1->nbands[i] = i;
1166  POSTGIS_RT_DEBUGF(4, "arg1->nbands[%d] = %d", arg1->nbands[i], i);
1167  }
1168  }
1169  }
1170 
1171  /* pad (4) and padnodata (5) */
1172  if (!PG_ARGISNULL(4)) {
1173  arg1->pad.pad = PG_GETARG_BOOL(4) ? 1 : 0;
1174 
1175  if (arg1->pad.pad && !PG_ARGISNULL(5)) {
1176  arg1->pad.hasnodata = 1;
1177  arg1->pad.nodataval = PG_GETARG_FLOAT8(5);
1178  }
1179  else {
1180  arg1->pad.hasnodata = 0;
1181  arg1->pad.nodataval = 0;
1182  }
1183  }
1184  else {
1185  arg1->pad.pad = 0;
1186  arg1->pad.hasnodata = 0;
1187  arg1->pad.nodataval = 0;
1188  }
1189 
1190  /* store some additional metadata */
1191  arg1->raster.srid = rt_raster_get_srid(arg1->raster.raster);
1192  arg1->raster.width = rt_raster_get_width(arg1->raster.raster);
1193  arg1->raster.height = rt_raster_get_height(arg1->raster.raster);
1194  rt_raster_get_geotransform_matrix(arg1->raster.raster, arg1->raster.gt);
1195 
1196  /* determine maximum number of tiles from raster */
1197  arg1->tile.nx = ceil(arg1->raster.width / (double) arg1->tile.width);
1198  arg1->tile.ny = ceil(arg1->raster.height / (double) arg1->tile.height);
1199  POSTGIS_RT_DEBUGF(4, "# of tiles (x, y) = (%d, %d)", arg1->tile.nx, arg1->tile.ny);
1200 
1201  /* Store needed information */
1202  funcctx->user_fctx = arg1;
1203 
1204  /* total number of tuples to be returned */
1205  funcctx->max_calls = (arg1->tile.nx * arg1->tile.ny);
1206 
1207  MemoryContextSwitchTo(oldcontext);
1208  }
1209 
1210  /* stuff done on every call of the function */
1211  funcctx = SRF_PERCALL_SETUP();
1212 
1213  call_cntr = funcctx->call_cntr;
1214  max_calls = funcctx->max_calls;
1215  arg2 = funcctx->user_fctx;
1216 
1217  /* do when there is more left to send */
1218  if (call_cntr < max_calls) {
1219  rt_pgraster *pgtile = NULL;
1220  rt_raster tile = NULL;
1221  rt_band _band = NULL;
1222  rt_band band = NULL;
1223  rt_pixtype pixtype = PT_END;
1224  int hasnodata = 0;
1225  double nodataval = 0;
1226  int width = 0;
1227  int height = 0;
1228 
1229  int k = 0;
1230  int tx = 0;
1231  int ty = 0;
1232  int rx = 0;
1233  int ry = 0;
1234  int ex = 0; /* edge tile on right */
1235  int ey = 0; /* edge tile on bottom */
1236  double ulx = 0;
1237  double uly = 0;
1238  uint16_t len = 0;
1239  void *vals = NULL;
1240  uint16_t nvals;
1241 
1242  POSTGIS_RT_DEBUGF(3, "call number %d", call_cntr);
1243 
1244  /*
1245  find offset based upon tile #
1246 
1247  0 1 2
1248  3 4 5
1249  6 7 8
1250  */
1251  ty = call_cntr / arg2->tile.nx;
1252  tx = call_cntr % arg2->tile.nx;
1253  POSTGIS_RT_DEBUGF(4, "tile (x, y) = (%d, %d)", tx, ty);
1254 
1255  /* edge tile? only important if padding is false */
1256  if (!arg2->pad.pad) {
1257  if (ty + 1 == arg2->tile.ny)
1258  ey = 1;
1259  if (tx + 1 == arg2->tile.nx)
1260  ex = 1;
1261  }
1262 
1263  /* upper-left of tile in raster coordinates */
1264  rx = tx * arg2->tile.width;
1265  ry = ty * arg2->tile.height;
1266  POSTGIS_RT_DEBUGF(4, "raster coordinates = %d, %d", rx, ry);
1267 
1268  /* determine tile width and height */
1269  /* default to user-defined */
1270  width = arg2->tile.width;
1271  height = arg2->tile.height;
1272 
1273  /* override user-defined if edge tile (only possible if padding is false */
1274  if (ex || ey) {
1275  /* right edge */
1276  if (ex)
1277  width = arg2->raster.width - rx;
1278  /* bottom edge */
1279  if (ey)
1280  height = arg2->raster.height - ry;
1281  }
1282 
1283  /* create empty raster */
1284  tile = rt_raster_new(width, height);
1285  rt_raster_set_geotransform_matrix(tile, arg2->raster.gt);
1286  rt_raster_set_srid(tile, arg2->raster.srid);
1287 
1288  /* upper-left of tile in spatial coordinates */
1289  if (rt_raster_cell_to_geopoint(arg2->raster.raster, rx, ry, &ulx, &uly, arg2->raster.gt) != ES_NONE) {
1290  rt_raster_destroy(tile);
1291  rt_raster_destroy(arg2->raster.raster);
1292  if (arg2->numbands) pfree(arg2->nbands);
1293  pfree(arg2);
1294  elog(ERROR, "RASTER_tile: Could not compute the coordinates of the upper-left corner of the output tile");
1295  SRF_RETURN_DONE(funcctx);
1296  }
1297  rt_raster_set_offsets(tile, ulx, uly);
1298  POSTGIS_RT_DEBUGF(4, "spatial coordinates = %f, %f", ulx, uly);
1299 
1300  /* compute length of pixel line to read */
1301  len = arg2->tile.width;
1302  if (rx + arg2->tile.width >= arg2->raster.width)
1303  len = arg2->raster.width - rx;
1304  POSTGIS_RT_DEBUGF(3, "read line len = %d", len);
1305 
1306  /* copy bands to tile */
1307  for (i = 0; i < arg2->numbands; i++) {
1308  POSTGIS_RT_DEBUGF(4, "copying band %d to tile %d", arg2->nbands[i], call_cntr);
1309 
1310  _band = rt_raster_get_band(arg2->raster.raster, arg2->nbands[i]);
1311  if (_band == NULL) {
1312  int nband = arg2->nbands[i] + 1;
1313  rt_raster_destroy(tile);
1314  rt_raster_destroy(arg2->raster.raster);
1315  pfree(arg2->nbands);
1316  pfree(arg2);
1317  elog(ERROR, "RASTER_tile: Could not get band %d from source raster", nband);
1318  SRF_RETURN_DONE(funcctx);
1319  }
1320 
1321  pixtype = rt_band_get_pixtype(_band);
1322  hasnodata = rt_band_get_hasnodata_flag(_band);
1323  if (hasnodata)
1324  rt_band_get_nodata(_band, &nodataval);
1325  else if (arg2->pad.pad && arg2->pad.hasnodata) {
1326  hasnodata = 1;
1327  nodataval = arg2->pad.nodataval;
1328  }
1329  else
1330  nodataval = rt_band_get_min_value(_band);
1331 
1332  /* inline band */
1333  if (!rt_band_is_offline(_band)) {
1334  if (rt_raster_generate_new_band(tile, pixtype, nodataval, hasnodata, nodataval, i) < 0) {
1335  rt_raster_destroy(tile);
1336  rt_raster_destroy(arg2->raster.raster);
1337  pfree(arg2->nbands);
1338  pfree(arg2);
1339  elog(ERROR, "RASTER_tile: Could not add new band to output tile");
1340  SRF_RETURN_DONE(funcctx);
1341  }
1342  band = rt_raster_get_band(tile, i);
1343  if (band == NULL) {
1344  rt_raster_destroy(tile);
1345  rt_raster_destroy(arg2->raster.raster);
1346  pfree(arg2->nbands);
1347  pfree(arg2);
1348  elog(ERROR, "RASTER_tile: Could not get newly added band from output tile");
1349  SRF_RETURN_DONE(funcctx);
1350  }
1351 
1352  /* if isnodata, set flag and continue */
1353  if (rt_band_get_isnodata_flag(_band)) {
1354  rt_band_set_isnodata_flag(band, 1);
1355  continue;
1356  }
1357 
1358  /* copy data */
1359  for (j = 0; j < arg2->tile.height; j++) {
1360  k = ry + j;
1361 
1362  if (k >= arg2->raster.height) {
1363  POSTGIS_RT_DEBUGF(4, "row %d is beyond extent of source raster. skipping", k);
1364  continue;
1365  }
1366 
1367  POSTGIS_RT_DEBUGF(4, "getting pixel line %d, %d for %d pixels", rx, k, len);
1368  if (rt_band_get_pixel_line(_band, rx, k, len, &vals, &nvals) != ES_NONE) {
1369  rt_raster_destroy(tile);
1370  rt_raster_destroy(arg2->raster.raster);
1371  pfree(arg2->nbands);
1372  pfree(arg2);
1373  elog(ERROR, "RASTER_tile: Could not get pixel line from source raster");
1374  SRF_RETURN_DONE(funcctx);
1375  }
1376 
1377  if (nvals && rt_band_set_pixel_line(band, 0, j, vals, nvals) != ES_NONE) {
1378  rt_raster_destroy(tile);
1379  rt_raster_destroy(arg2->raster.raster);
1380  pfree(arg2->nbands);
1381  pfree(arg2);
1382  elog(ERROR, "RASTER_tile: Could not set pixel line of output tile");
1383  SRF_RETURN_DONE(funcctx);
1384  }
1385  }
1386  }
1387  /* offline */
1388  else {
1389  uint8_t bandnum = 0;
1390  rt_band_get_ext_band_num(_band, &bandnum);
1391 
1392  band = rt_band_new_offline(
1393  width, height,
1394  pixtype,
1395  hasnodata, nodataval,
1396  bandnum, rt_band_get_ext_path(_band)
1397  );
1398 
1399  if (band == NULL) {
1400  rt_raster_destroy(tile);
1401  rt_raster_destroy(arg2->raster.raster);
1402  pfree(arg2->nbands);
1403  pfree(arg2);
1404  elog(ERROR, "RASTER_tile: Could not create new offline band for output tile");
1405  SRF_RETURN_DONE(funcctx);
1406  }
1407 
1408  if (rt_raster_add_band(tile, band, i) < 0) {
1409  rt_band_destroy(band);
1410  rt_raster_destroy(tile);
1411  rt_raster_destroy(arg2->raster.raster);
1412  pfree(arg2->nbands);
1413  pfree(arg2);
1414  elog(ERROR, "RASTER_tile: Could not add new offline band to output tile");
1415  SRF_RETURN_DONE(funcctx);
1416  }
1417  }
1418  }
1419 
1420  pgtile = rt_raster_serialize(tile);
1421  rt_raster_destroy(tile);
1422  if (!pgtile) {
1423  rt_raster_destroy(arg2->raster.raster);
1424  if (arg2->numbands) pfree(arg2->nbands);
1425  pfree(arg2);
1426  SRF_RETURN_DONE(funcctx);
1427  }
1428 
1429  SET_VARSIZE(pgtile, pgtile->size);
1430  SRF_RETURN_NEXT(funcctx, PointerGetDatum(pgtile));
1431  }
1432  /* do when there is no more left */
1433  else {
1434  rt_raster_destroy(arg2->raster.raster);
1435  if (arg2->numbands) pfree(arg2->nbands);
1436  pfree(arg2);
1437  SRF_RETURN_DONE(funcctx);
1438  }
1439 }
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_serialize.c:521
uint16_t 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:329
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:340
#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:1730
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:363
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:1137
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:674
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:1347
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:376
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:695
#define FALSE
Definition: dbfopen.c:168
Struct definitions.
Definition: librtcore.h:2250
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:1745
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
Definition: rt_band.c:631
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:853
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:714
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:124
Here is the call graph for this function:
Here is the caller graph for this function: