Construct a new rt_raster from an existing rt_raster and an array of band numbers.
1430 {
1432 int i = 0;
1433 int j = 0;
1434 int idx;
1435 int32_t flag;
1436 double gt[6] = {0.};
1437
1438 assert(NULL != raster);
1439 assert(NULL != bandNums);
1440
1441 RASTER_DEBUGF(3,
"rt_raster_from_band: source raster has %d bands",
1443
1444
1446 if (NULL == rast) {
1447 rterror(
"rt_raster_from_band: Out of memory allocating new raster");
1448 return NULL;
1449 }
1450
1451
1454
1455
1457
1458
1459 for (i = 0; i <
count; i++) {
1460 idx = bandNums[i];
1462
1463 if (flag < 0) {
1464 rterror(
"rt_raster_from_band: Could not copy band");
1467 return NULL;
1468 }
1469
1470 RASTER_DEBUGF(3,
"rt_raster_from_band: band created at index %d",
1471 flag);
1472 }
1473
1474 RASTER_DEBUGF(3,
"rt_raster_from_band: new raster has %d bands",
1477}
void rterror(const char *fmt,...)
Wrappers used for reporting errors and info.
#define RASTER_DEBUGF(level, msg,...)
void rt_band_destroy(rt_band band)
Destroy a raster band.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
void rt_raster_set_geotransform_matrix(rt_raster raster, double *gt)
Set raster's geotransform using 6-element array.
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
uint16_t rt_raster_get_num_bands(rt_raster raster)
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
int rt_raster_copy_band(rt_raster torast, rt_raster fromrast, int fromindex, int toindex)
Copy one band from one raster to another.
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.