PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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;
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}
@ PT_32BUI
Definition librtcore.h:197
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition rt_raster.c:52
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:1253
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
Definition rt_band.c:892
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:1341
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
Definition rt_raster.c:1240
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition rtrowdump.py:125
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void cu_free_raster(rt_raster raster)

References cu_add_band(), cu_free_raster(), PT_32BUI, rt_band_set_nodata(), rt_raster_from_band(), rt_raster_has_band(), rt_raster_is_empty(), and rt_raster_new().

Referenced by raster_basics_suite_setup().

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