PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ test_raster_from_band()

static void test_raster_from_band ( )
static

Definition at line 143 of file cu_raster_basics.c.

143  {
144  uint32_t bandNums[] = {1,3};
145  int lenBandNums = 2;
147  rt_raster rast;
148  rt_band band;
149  uint32_t xmax = 100;
150  uint32_t ymax = 100;
151  uint32_t x;
152 
153  raster = rt_raster_new(xmax, ymax);
154  CU_ASSERT(raster != NULL);
155 
156  for (x = 0; x < 5; x++) {
157  band = cu_add_band(raster, PT_32BUI, 0, 0);
158  CU_ASSERT(band != NULL);
159  rt_band_set_nodata(band, 0, NULL);
160  }
161 
162  rast = rt_raster_from_band(raster, bandNums, lenBandNums);
163  CU_ASSERT(rast != NULL);
164 
165  CU_ASSERT(!rt_raster_is_empty(rast));
166  CU_ASSERT(rt_raster_has_band(rast, 1));
167 
170 }
@ PT_32BUI
Definition: librtcore.h:194
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
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
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
Definition: rt_band.c:733
rt_raster rt_raster_from_band(rt_raster raster, uint32_t *bandNums, int count)
Construct a new rt_raster from an existing rt_raster and an array of band numbers.
Definition: rt_raster.c:1435
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
Definition: rt_raster.c:1334
band
Definition: ovdump.py:57
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void cu_free_raster(rt_raster raster)
unsigned int uint32_t
Definition: uthash.h:78

References ovdump::band, cu_add_band(), cu_free_raster(), PT_32BUI, rtpixdump::rast, rtrowdump::raster, rt_band_set_nodata(), rt_raster_from_band(), rt_raster_has_band(), rt_raster_is_empty(), rt_raster_new(), and pixval::x.

Referenced by raster_basics_suite_setup().

Here is the call graph for this function:
Here is the caller graph for this function: