PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ fillRasterToPolygonize()

static rt_raster fillRasterToPolygonize ( int  hasnodata,
double  nodataval 
)
static

Definition at line 109 of file cu_gdal.c.

References ovdump::band, cu_add_band(), PT_32BF, rtrowdump::raster, rt_band_get_height(), rt_band_get_width(), rt_band_set_pixel(), rt_raster_new(), rt_raster_set_scale(), pixval::x, and pixval::y.

Referenced by test_gdal_polygonize().

109  {
110  rt_band band = NULL;
111  rt_pixtype pixtype = PT_32BF;
112 
113  /* Create raster */
114  uint16_t width = 9;
115  uint16_t height = 9;
116 
117  rt_raster raster = rt_raster_new(width, height);
118  rt_raster_set_scale(raster, 1, 1);
119 
120  band = cu_add_band(raster, pixtype, hasnodata, nodataval);
121  CU_ASSERT(band != NULL);
122 
123  {
124  int x, y;
125  for (x = 0; x < rt_band_get_width(band); ++x)
126  for (y = 0; y < rt_band_get_height(band); ++y)
127  rt_band_set_pixel(band, x, y, 0.0, NULL);
128  }
129 
130  rt_band_set_pixel(band, 3, 1, 1.8, NULL);
131  rt_band_set_pixel(band, 4, 1, 1.8, NULL);
132  rt_band_set_pixel(band, 5, 1, 2.8, NULL);
133  rt_band_set_pixel(band, 2, 2, 1.8, NULL);
134  rt_band_set_pixel(band, 3, 2, 1.8, NULL);
135  rt_band_set_pixel(band, 4, 2, 1.8, NULL);
136  rt_band_set_pixel(band, 5, 2, 2.8, NULL);
137  rt_band_set_pixel(band, 6, 2, 2.8, NULL);
138  rt_band_set_pixel(band, 1, 3, 1.8, NULL);
139  rt_band_set_pixel(band, 2, 3, 1.8, NULL);
140  rt_band_set_pixel(band, 6, 3, 2.8, NULL);
141  rt_band_set_pixel(band, 7, 3, 2.8, NULL);
142  rt_band_set_pixel(band, 1, 4, 1.8, NULL);
143  rt_band_set_pixel(band, 2, 4, 1.8, NULL);
144  rt_band_set_pixel(band, 6, 4, 2.8, NULL);
145  rt_band_set_pixel(band, 7, 4, 2.8, NULL);
146  rt_band_set_pixel(band, 1, 5, 1.8, NULL);
147  rt_band_set_pixel(band, 2, 5, 1.8, NULL);
148  rt_band_set_pixel(band, 6, 5, 2.8, NULL);
149  rt_band_set_pixel(band, 7, 5, 2.8, NULL);
150  rt_band_set_pixel(band, 2, 6, 1.8, NULL);
151  rt_band_set_pixel(band, 3, 6, 1.8, NULL);
152  rt_band_set_pixel(band, 4, 6, 1.8, NULL);
153  rt_band_set_pixel(band, 5, 6, 2.8, NULL);
154  rt_band_set_pixel(band, 6, 6, 2.8, NULL);
155  rt_band_set_pixel(band, 3, 7, 1.8, NULL);
156  rt_band_set_pixel(band, 4, 7, 1.8, NULL);
157  rt_band_set_pixel(band, 5, 7, 2.8, NULL);
158 
159  return raster;
160 }
raster
Be careful!! Zeros function&#39;s input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
band
Definition: ovdump.py:57
rt_pixtype
Definition: librtcore.h:185
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_raster.c:137
uint16_t rt_band_get_width(rt_band band)
Return width of this band.
Definition: rt_band.c:507
uint16_t rt_band_get_height(rt_band band)
Return height of this band.
Definition: rt_band.c:516
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
Definition: rt_raster.c:48
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel&#39;s value.
Definition: rt_band.c:841
Here is the call graph for this function:
Here is the caller graph for this function: