PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ test_raster_from_band()

static void test_raster_from_band ( )
static

Definition at line 143 of file cu_raster_basics.c.

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().

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 
168  cu_free_raster(rast);
169  cu_free_raster(raster);
170 }
raster
Be careful!! Zeros function&#39;s input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
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:1439
band
Definition: ovdump.py:57
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
Definition: rt_band.c:600
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
Definition: rt_raster.c:1338
unsigned int uint32_t
Definition: uthash.h:78
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
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:1351
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
Here is the call graph for this function:
Here is the caller graph for this function: