Add band data to a raster. 
- Parameters
- 
  
    | raster | : the raster to add a band to |  | band | : the band to add, ownership left to caller. Band dimensions are required to match with raster ones. |  | index | : the position where to insert the new band (0 based) |  
 
- Returns
- identifier (position) for the just-added raster, or -1 on error 
Definition at line 405 of file rt_raster.c.
  412                 assert(NULL != 
band);
 
  417         rterror(
"rt_raster_add_band: Can't add a %dx%d band to a %dx%d raster",
 
  422     if (index > 
raster->numBands)
 
  438     if (NULL == 
raster->bands) {
 
  439         rterror(
"rt_raster_add_band: Out of virtual memory " 
  440                 "reallocating band pointers");
 
  447     for (i = 0; i <= 
raster->numBands; ++i) {
 
  449             oldband = 
raster->bands[i];
 
  451         } 
else if (i > index) {
 
  452             tmpband = 
raster->bands[i];
 
  453             raster->bands[i] = oldband;
 
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
#define RASTER_DEBUG(level, msg)
#define RASTER_DEBUGF(level, msg,...)
void * rtrealloc(void *mem, size_t size)
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
 
References ovdump::band, rtrowdump::raster, RASTER_DEBUG, RASTER_DEBUGF, rterror(), and rtrealloc().
Referenced by cu_add_band(), RASTER_addBandOutDB(), RASTER_clip(), RASTER_tile(), rt_raster_colormap(), rt_raster_copy_band(), rt_raster_generate_new_band(), and test_band_metadata().