Construct a new rt_raster from an existing rt_raster and an array of band numbers.
1341 {
1343 int i = 0;
1344 int j = 0;
1345 int idx;
1346 int32_t flag;
1347 double gt[6] = {0.};
1348
1349 assert(NULL != raster);
1350 assert(NULL != bandNums);
1351
1352 RASTER_DEBUGF(3,
"rt_raster_from_band: source raster has %d bands",
1354
1355
1357 if (NULL == rast) {
1358 rterror(
"rt_raster_from_band: Out of memory allocating new raster");
1359 return NULL;
1360 }
1361
1362
1365
1366
1368
1369
1370 for (i = 0; i <
count; i++) {
1371 idx = bandNums[i];
1373
1374 if (flag < 0) {
1375 rterror(
"rt_raster_from_band: Could not copy band");
1378 return NULL;
1379 }
1380
1381 RASTER_DEBUGF(3,
"rt_raster_from_band: band created at index %d",
1382 flag);
1383 }
1384
1385 RASTER_DEBUGF(3,
"rt_raster_from_band: new raster has %d bands",
1388}
void rterror(const char *fmt,...) __attribute__((format(printf
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.