PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_tile ( PG_FUNCTION_ARGS  )

Definition at line 6111 of file rt_pg.c.

References ovdump::band, ES_NONE, FALSE, window::gt, pixval::nband, POSTGIS_RT_DEBUG, POSTGIS_RT_DEBUGF, PT_END, rtrowdump::raster, 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.

6112 {
6113  FuncCallContext *funcctx;
6114  int call_cntr;
6115  int max_calls;
6116  int i = 0;
6117  int j = 0;
6118 
6119  struct tile_arg_t {
6120 
6121  struct {
6122  rt_raster raster;
6123  double gt[6];
6124  int srid;
6125  int width;
6126  int height;
6127  } raster;
6128 
6129  struct {
6130  int width;
6131  int height;
6132 
6133  int nx;
6134  int ny;
6135  } tile;
6136 
6137  int numbands;
6138  int *nbands;
6139 
6140  struct {
6141  int pad;
6142  double hasnodata;
6143  double nodataval;
6144  } pad;
6145  };
6146  struct tile_arg_t *arg1 = NULL;
6147  struct tile_arg_t *arg2 = NULL;
6148 
6149  if (SRF_IS_FIRSTCALL()) {
6150  MemoryContext oldcontext;
6151  rt_pgraster *pgraster = NULL;
6152  int numbands;
6153 
6154  ArrayType *array;
6155  Oid etype;
6156  Datum *e;
6157  bool *nulls;
6158 
6159  int16 typlen;
6160  bool typbyval;
6161  char typalign;
6162 
6163  POSTGIS_RT_DEBUG(2, "RASTER_tile: first call");
6164 
6165  /* create a function context for cross-call persistence */
6166  funcctx = SRF_FIRSTCALL_INIT();
6167 
6168  /* switch to memory context appropriate for multiple function calls */
6169  oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
6170 
6171  /* Get input arguments */
6172  if (PG_ARGISNULL(0)) {
6173  MemoryContextSwitchTo(oldcontext);
6174  SRF_RETURN_DONE(funcctx);
6175  }
6176 
6177  /* allocate arg1 */
6178  arg1 = palloc(sizeof(struct tile_arg_t));
6179  if (arg1 == NULL) {
6180  MemoryContextSwitchTo(oldcontext);
6181  elog(ERROR, "RASTER_tile: Could not allocate memory for arguments");
6182  SRF_RETURN_DONE(funcctx);
6183  }
6184 
6185  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
6186  arg1->raster.raster = rt_raster_deserialize(pgraster, FALSE);
6187  if (!arg1->raster.raster) {
6188  ereport(ERROR, (
6189  errcode(ERRCODE_OUT_OF_MEMORY),
6190  errmsg("Could not deserialize raster")
6191  ));
6192  pfree(arg1);
6193  PG_FREE_IF_COPY(pgraster, 0);
6194  MemoryContextSwitchTo(oldcontext);
6195  SRF_RETURN_DONE(funcctx);
6196  }
6197 
6198  /* raster has bands */
6199  numbands = rt_raster_get_num_bands(arg1->raster.raster);
6200  /*
6201  if (!numbands) {
6202  elog(NOTICE, "Raster provided has no bands");
6203  rt_raster_destroy(arg1->raster.raster);
6204  pfree(arg1);
6205  PG_FREE_IF_COPY(pgraster, 0);
6206  MemoryContextSwitchTo(oldcontext);
6207  SRF_RETURN_DONE(funcctx);
6208  }
6209  */
6210 
6211  /* width (1) */
6212  if (PG_ARGISNULL(1)) {
6213  elog(NOTICE, "Width cannot be NULL. Returning NULL");
6214  rt_raster_destroy(arg1->raster.raster);
6215  pfree(arg1);
6216  PG_FREE_IF_COPY(pgraster, 0);
6217  MemoryContextSwitchTo(oldcontext);
6218  SRF_RETURN_DONE(funcctx);
6219  }
6220  arg1->tile.width = PG_GETARG_INT32(1);
6221  if (arg1->tile.width < 1) {
6222  elog(NOTICE, "Width must be greater than zero. Returning NULL");
6223  rt_raster_destroy(arg1->raster.raster);
6224  pfree(arg1);
6225  PG_FREE_IF_COPY(pgraster, 0);
6226  MemoryContextSwitchTo(oldcontext);
6227  SRF_RETURN_DONE(funcctx);
6228  }
6229 
6230  /* height (2) */
6231  if (PG_ARGISNULL(2)) {
6232  elog(NOTICE, "Height cannot be NULL. Returning NULL");
6233  rt_raster_destroy(arg1->raster.raster);
6234  pfree(arg1);
6235  PG_FREE_IF_COPY(pgraster, 0);
6236  MemoryContextSwitchTo(oldcontext);
6237  SRF_RETURN_DONE(funcctx);
6238  }
6239  arg1->tile.height = PG_GETARG_INT32(2);
6240  if (arg1->tile.height < 1) {
6241  elog(NOTICE, "Height must be greater than zero. Returning NULL");
6242  rt_raster_destroy(arg1->raster.raster);
6243  pfree(arg1);
6244  PG_FREE_IF_COPY(pgraster, 0);
6245  MemoryContextSwitchTo(oldcontext);
6246  SRF_RETURN_DONE(funcctx);
6247  }
6248 
6249  /* nband, array (3) */
6250  if (numbands && !PG_ARGISNULL(3)) {
6251  array = PG_GETARG_ARRAYTYPE_P(3);
6252  etype = ARR_ELEMTYPE(array);
6253  get_typlenbyvalalign(etype, &typlen, &typbyval, &typalign);
6254 
6255  switch (etype) {
6256  case INT2OID:
6257  case INT4OID:
6258  break;
6259  default:
6260  rt_raster_destroy(arg1->raster.raster);
6261  pfree(arg1);
6262  PG_FREE_IF_COPY(pgraster, 0);
6263  MemoryContextSwitchTo(oldcontext);
6264  elog(ERROR, "RASTER_tile: Invalid data type for band indexes");
6265  SRF_RETURN_DONE(funcctx);
6266  break;
6267  }
6268 
6269  deconstruct_array(array, etype, typlen, typbyval, typalign, &e, &nulls, &(arg1->numbands));
6270 
6271  arg1->nbands = palloc(sizeof(int) * arg1->numbands);
6272  if (arg1->nbands == NULL) {
6273  rt_raster_destroy(arg1->raster.raster);
6274  pfree(arg1);
6275  PG_FREE_IF_COPY(pgraster, 0);
6276  MemoryContextSwitchTo(oldcontext);
6277  elog(ERROR, "RASTER_tile: Could not allocate memory for band indexes");
6278  SRF_RETURN_DONE(funcctx);
6279  }
6280 
6281  for (i = 0, j = 0; i < arg1->numbands; i++) {
6282  if (nulls[i]) continue;
6283 
6284  switch (etype) {
6285  case INT2OID:
6286  arg1->nbands[j] = DatumGetInt16(e[i]) - 1;
6287  break;
6288  case INT4OID:
6289  arg1->nbands[j] = DatumGetInt32(e[i]) - 1;
6290  break;
6291  }
6292 
6293  j++;
6294  }
6295 
6296  if (j < arg1->numbands) {
6297  arg1->nbands = repalloc(arg1->nbands, sizeof(int) * j);
6298  if (arg1->nbands == NULL) {
6299  rt_raster_destroy(arg1->raster.raster);
6300  pfree(arg1);
6301  PG_FREE_IF_COPY(pgraster, 0);
6302  MemoryContextSwitchTo(oldcontext);
6303  elog(ERROR, "RASTER_tile: Could not reallocate memory for band indexes");
6304  SRF_RETURN_DONE(funcctx);
6305  }
6306 
6307  arg1->numbands = j;
6308  }
6309 
6310  /* validate nbands */
6311  for (i = 0; i < arg1->numbands; i++) {
6312  if (!rt_raster_has_band(arg1->raster.raster, arg1->nbands[i])) {
6313  elog(NOTICE, "Band at index %d not found in raster", arg1->nbands[i] + 1);
6314  rt_raster_destroy(arg1->raster.raster);
6315  pfree(arg1->nbands);
6316  pfree(arg1);
6317  PG_FREE_IF_COPY(pgraster, 0);
6318  MemoryContextSwitchTo(oldcontext);
6319  SRF_RETURN_DONE(funcctx);
6320  }
6321  }
6322  }
6323  else {
6324  arg1->numbands = numbands;
6325 
6326  if (numbands) {
6327  arg1->nbands = palloc(sizeof(int) * arg1->numbands);
6328 
6329  if (arg1->nbands == NULL) {
6330  rt_raster_destroy(arg1->raster.raster);
6331  pfree(arg1);
6332  PG_FREE_IF_COPY(pgraster, 0);
6333  MemoryContextSwitchTo(oldcontext);
6334  elog(ERROR, "RASTER_dumpValues: Could not allocate memory for pixel values");
6335  SRF_RETURN_DONE(funcctx);
6336  }
6337 
6338  for (i = 0; i < arg1->numbands; i++) {
6339  arg1->nbands[i] = i;
6340  POSTGIS_RT_DEBUGF(4, "arg1->nbands[%d] = %d", arg1->nbands[i], i);
6341  }
6342  }
6343  }
6344 
6345  /* pad (4) and padnodata (5) */
6346  if (!PG_ARGISNULL(4)) {
6347  arg1->pad.pad = PG_GETARG_BOOL(4) ? 1 : 0;
6348 
6349  if (arg1->pad.pad && !PG_ARGISNULL(5)) {
6350  arg1->pad.hasnodata = 1;
6351  arg1->pad.nodataval = PG_GETARG_FLOAT8(5);
6352  }
6353  else {
6354  arg1->pad.hasnodata = 0;
6355  arg1->pad.nodataval = 0;
6356  }
6357  }
6358  else {
6359  arg1->pad.pad = 0;
6360  arg1->pad.hasnodata = 0;
6361  arg1->pad.nodataval = 0;
6362  }
6363 
6364  /* store some additional metadata */
6365  arg1->raster.srid = rt_raster_get_srid(arg1->raster.raster);
6366  arg1->raster.width = rt_raster_get_width(arg1->raster.raster);
6367  arg1->raster.height = rt_raster_get_height(arg1->raster.raster);
6368  rt_raster_get_geotransform_matrix(arg1->raster.raster, arg1->raster.gt);
6369 
6370  /* determine maximum number of tiles from raster */
6371  arg1->tile.nx = ceil(arg1->raster.width / (double) arg1->tile.width);
6372  arg1->tile.ny = ceil(arg1->raster.height / (double) arg1->tile.height);
6373  POSTGIS_RT_DEBUGF(4, "# of tiles (x, y) = (%d, %d)", arg1->tile.nx, arg1->tile.ny);
6374 
6375  /* Store needed information */
6376  funcctx->user_fctx = arg1;
6377 
6378  /* total number of tuples to be returned */
6379  funcctx->max_calls = (arg1->tile.nx * arg1->tile.ny);
6380 
6381  MemoryContextSwitchTo(oldcontext);
6382  }
6383 
6384  /* stuff done on every call of the function */
6385  funcctx = SRF_PERCALL_SETUP();
6386 
6387  call_cntr = funcctx->call_cntr;
6388  max_calls = funcctx->max_calls;
6389  arg2 = funcctx->user_fctx;
6390 
6391  /* do when there is more left to send */
6392  if (call_cntr < max_calls) {
6393  rt_pgraster *pgtile = NULL;
6394  rt_raster tile = NULL;
6395  rt_band _band = NULL;
6396  rt_band band = NULL;
6397  rt_pixtype pixtype = PT_END;
6398  int hasnodata = 0;
6399  double nodataval = 0;
6400  int width = 0;
6401  int height = 0;
6402 
6403  int k = 0;
6404  int tx = 0;
6405  int ty = 0;
6406  int rx = 0;
6407  int ry = 0;
6408  int ex = 0; /* edge tile on right */
6409  int ey = 0; /* edge tile on bottom */
6410  double ulx = 0;
6411  double uly = 0;
6412  uint16_t len = 0;
6413  void *vals = NULL;
6414  uint16_t nvals;
6415 
6416  POSTGIS_RT_DEBUGF(3, "call number %d", call_cntr);
6417 
6418  /*
6419  find offset based upon tile #
6420 
6421  0 1 2
6422  3 4 5
6423  6 7 8
6424  */
6425  ty = call_cntr / arg2->tile.nx;
6426  tx = call_cntr % arg2->tile.nx;
6427  POSTGIS_RT_DEBUGF(4, "tile (x, y) = (%d, %d)", tx, ty);
6428 
6429  /* edge tile? only important if padding is false */
6430  if (!arg2->pad.pad) {
6431  if (ty + 1 == arg2->tile.ny)
6432  ey = 1;
6433  if (tx + 1 == arg2->tile.nx)
6434  ex = 1;
6435  }
6436 
6437  /* upper-left of tile in raster coordinates */
6438  rx = tx * arg2->tile.width;
6439  ry = ty * arg2->tile.height;
6440  POSTGIS_RT_DEBUGF(4, "raster coordinates = %d, %d", rx, ry);
6441 
6442  /* determine tile width and height */
6443  /* default to user-defined */
6444  width = arg2->tile.width;
6445  height = arg2->tile.height;
6446 
6447  /* override user-defined if edge tile (only possible if padding is false */
6448  if (ex || ey) {
6449  /* right edge */
6450  if (ex)
6451  width = arg2->raster.width - rx;
6452  /* bottom edge */
6453  if (ey)
6454  height = arg2->raster.height - ry;
6455  }
6456 
6457  /* create empty raster */
6458  tile = rt_raster_new(width, height);
6459  rt_raster_set_geotransform_matrix(tile, arg2->raster.gt);
6460  rt_raster_set_srid(tile, arg2->raster.srid);
6461 
6462  /* upper-left of tile in spatial coordinates */
6463  if (rt_raster_cell_to_geopoint(arg2->raster.raster, rx, ry, &ulx, &uly, arg2->raster.gt) != ES_NONE) {
6464  rt_raster_destroy(tile);
6465  rt_raster_destroy(arg2->raster.raster);
6466  if (arg2->numbands) pfree(arg2->nbands);
6467  pfree(arg2);
6468  elog(ERROR, "RASTER_tile: Could not compute the coordinates of the upper-left corner of the output tile");
6469  SRF_RETURN_DONE(funcctx);
6470  }
6471  rt_raster_set_offsets(tile, ulx, uly);
6472  POSTGIS_RT_DEBUGF(4, "spatial coordinates = %f, %f", ulx, uly);
6473 
6474  /* compute length of pixel line to read */
6475  len = arg2->tile.width;
6476  if (rx + arg2->tile.width >= arg2->raster.width)
6477  len = arg2->raster.width - rx;
6478  POSTGIS_RT_DEBUGF(3, "read line len = %d", len);
6479 
6480  /* copy bands to tile */
6481  for (i = 0; i < arg2->numbands; i++) {
6482  POSTGIS_RT_DEBUGF(4, "copying band %d to tile %d", arg2->nbands[i], call_cntr);
6483 
6484  _band = rt_raster_get_band(arg2->raster.raster, arg2->nbands[i]);
6485  if (_band == NULL) {
6486  int nband = arg2->nbands[i] + 1;
6487  rt_raster_destroy(tile);
6488  rt_raster_destroy(arg2->raster.raster);
6489  if (arg2->numbands) pfree(arg2->nbands);
6490  pfree(arg2);
6491  elog(ERROR, "RASTER_tile: Could not get band %d from source raster", nband);
6492  SRF_RETURN_DONE(funcctx);
6493  }
6494 
6495  pixtype = rt_band_get_pixtype(_band);
6496  hasnodata = rt_band_get_hasnodata_flag(_band);
6497  if (hasnodata)
6498  rt_band_get_nodata(_band, &nodataval);
6499  else if (arg2->pad.pad && arg2->pad.hasnodata) {
6500  hasnodata = 1;
6501  nodataval = arg2->pad.nodataval;
6502  }
6503  else
6504  nodataval = rt_band_get_min_value(_band);
6505 
6506  /* inline band */
6507  if (!rt_band_is_offline(_band)) {
6508  if (rt_raster_generate_new_band(tile, pixtype, nodataval, hasnodata, nodataval, i) < 0) {
6509  rt_raster_destroy(tile);
6510  rt_raster_destroy(arg2->raster.raster);
6511  pfree(arg2->nbands);
6512  pfree(arg2);
6513  elog(ERROR, "RASTER_tile: Could not add new band to output tile");
6514  SRF_RETURN_DONE(funcctx);
6515  }
6516  band = rt_raster_get_band(tile, i);
6517  if (band == NULL) {
6518  rt_raster_destroy(tile);
6519  rt_raster_destroy(arg2->raster.raster);
6520  if (arg2->numbands) pfree(arg2->nbands);
6521  pfree(arg2);
6522  elog(ERROR, "RASTER_tile: Could not get newly added band from output tile");
6523  SRF_RETURN_DONE(funcctx);
6524  }
6525 
6526  /* if isnodata, set flag and continue */
6527  if (rt_band_get_isnodata_flag(_band)) {
6528  rt_band_set_isnodata_flag(band, 1);
6529  continue;
6530  }
6531 
6532  /* copy data */
6533  for (j = 0; j < arg2->tile.height; j++) {
6534  k = ry + j;
6535 
6536  if (k >= arg2->raster.height) {
6537  POSTGIS_RT_DEBUGF(4, "row %d is beyond extent of source raster. skipping", k);
6538  continue;
6539  }
6540 
6541  POSTGIS_RT_DEBUGF(4, "getting pixel line %d, %d for %d pixels", rx, k, len);
6542  if (rt_band_get_pixel_line(_band, rx, k, len, &vals, &nvals) != ES_NONE) {
6543  rt_raster_destroy(tile);
6544  rt_raster_destroy(arg2->raster.raster);
6545  if (arg2->numbands) pfree(arg2->nbands);
6546  pfree(arg2);
6547  elog(ERROR, "RASTER_tile: Could not get pixel line from source raster");
6548  SRF_RETURN_DONE(funcctx);
6549  }
6550 
6551  if (nvals && rt_band_set_pixel_line(band, 0, j, vals, nvals) != ES_NONE) {
6552  rt_raster_destroy(tile);
6553  rt_raster_destroy(arg2->raster.raster);
6554  if (arg2->numbands) pfree(arg2->nbands);
6555  pfree(arg2);
6556  elog(ERROR, "RASTER_tile: Could not set pixel line of output tile");
6557  SRF_RETURN_DONE(funcctx);
6558  }
6559  }
6560  }
6561  /* offline */
6562  else {
6563  uint8_t bandnum = 0;
6564  rt_band_get_ext_band_num(_band, &bandnum);
6565 
6566  band = rt_band_new_offline(
6567  width, height,
6568  pixtype,
6569  hasnodata, nodataval,
6570  bandnum, rt_band_get_ext_path(_band)
6571  );
6572 
6573  if (band == NULL) {
6574  rt_raster_destroy(tile);
6575  rt_raster_destroy(arg2->raster.raster);
6576  if (arg2->numbands) pfree(arg2->nbands);
6577  pfree(arg2);
6578  elog(ERROR, "RASTER_tile: Could not create new offline band for output tile");
6579  SRF_RETURN_DONE(funcctx);
6580  }
6581 
6582  if (rt_raster_add_band(tile, band, i) < 0) {
6583  rt_band_destroy(band);
6584  rt_raster_destroy(tile);
6585  rt_raster_destroy(arg2->raster.raster);
6586  if (arg2->numbands) pfree(arg2->nbands);
6587  pfree(arg2);
6588  elog(ERROR, "RASTER_tile: Could not add new offline band to output tile");
6589  SRF_RETURN_DONE(funcctx);
6590  }
6591  }
6592  }
6593 
6594  pgtile = rt_raster_serialize(tile);
6595  rt_raster_destroy(tile);
6596  if (!pgtile) {
6597  rt_raster_destroy(arg2->raster.raster);
6598  if (arg2->numbands) pfree(arg2->nbands);
6599  pfree(arg2);
6600  SRF_RETURN_DONE(funcctx);
6601  }
6602 
6603  SET_VARSIZE(pgtile, pgtile->size);
6604  SRF_RETURN_NEXT(funcctx, PointerGetDatum(pgtile));
6605  }
6606  /* do when there is no more left */
6607  else {
6608  rt_raster_destroy(arg2->raster.raster);
6609  if (arg2->numbands) pfree(arg2->nbands);
6610  pfree(arg2);
6611  SRF_RETURN_DONE(funcctx);
6612  }
6613 }
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
Definition: rt_api.c:1636
int rt_raster_get_num_bands(rt_raster raster)
Definition: rt_api.c:5677
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_api.c:8158
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
tuple gt
Definition: window.py:79
Definition: rt_api.h:184
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
Definition: rt_api.c:1900
tuple band
Definition: ovdump.py:57
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_api.c:8563
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
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_api.c:2181
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
Definition: rt_api.c:5668
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
Definition: rt_api.c:5661
int rt_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
Definition: rt_api.c:2042
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_api.c:6054
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition: rt_api.c:6005
int rt_raster_add_band(rt_raster raster, rt_band band, int index)
Add band data to a raster.
Definition: rt_api.c:5706
rt_pixtype
Definition: rt_api.h:172
rt_errorstate rt_band_set_isnodata_flag(rt_band band, int flag)
Set isnodata flag value.
Definition: rt_api.c:2023
#define POSTGIS_RT_DEBUG(level, msg)
Definition: rt_pg.h:58
tuple nband
Definition: pixval.py:52
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_api.c:1527
double rt_band_get_min_value(rt_band band)
Returns the minimal possible value for the band according to the pixel type.
Definition: rt_api.c:3073
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
Definition: rt_api.c:3058
void rt_raster_set_geotransform_matrix(rt_raster raster, double *gt)
Set raster's geotransform using 6-element array.
Definition: rt_api.c:6026
void rt_band_destroy(rt_band band)
Destroy a raster band.
Definition: rt_api.c:1650
uint16_t rt_raster_get_height(rt_raster raster)
Definition: rt_api.c:5434
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_api.c:2465
rt_band rt_raster_get_band(rt_raster raster, int n)
Return Nth band, or NULL if unavailable.
Definition: rt_api.c:5686
#define FALSE
Definition: dbfopen.c:169
Struct definitions.
Definition: rt_api.h:2175
#define POSTGIS_RT_DEBUGF(level, msg,...)
Definition: rt_pg.h:62
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_api.c:8350
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_api.c:5353
rt_errorstate rt_band_get_ext_band_num(rt_band band, uint8_t *bandnum)
Return bands' external band number (only valid when rt_band_is_offline returns non-zero).
Definition: rt_api.c:1686
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
Definition: rt_api.c:2002
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_api.c:5504
uint16_t rt_raster_get_width(rt_raster raster)
Definition: rt_api.c:5426
const char * rt_band_get_ext_path(rt_band band)
Return band's external path (only valid when rt_band_is_offline returns non-zero).
Definition: rt_api.c:1673
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_api.c:5784

Here is the call graph for this function: