PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ fillRasterToPolygonize()

static rt_raster fillRasterToPolygonize ( int  hasnodata,
double  nodataval 
)
static

Definition at line 101 of file cu_gdal.c.

101  {
102  rt_band band = NULL;
103  rt_pixtype pixtype = PT_32BF;
104 
105  /* Create raster */
106  uint16_t width = 9;
107  uint16_t height = 9;
108 
109  rt_raster raster = rt_raster_new(width, height);
111 
112  band = cu_add_band(raster, pixtype, hasnodata, nodataval);
113  CU_ASSERT(band != NULL);
114 
115  {
116  int x, y;
117  for (x = 0; x < rt_band_get_width(band); ++x)
118  for (y = 0; y < rt_band_get_height(band); ++y)
119  rt_band_set_pixel(band, x, y, 0.0, NULL);
120  }
121 
122  rt_band_set_pixel(band, 3, 1, 1.8, NULL);
123  rt_band_set_pixel(band, 4, 1, 1.8, NULL);
124  rt_band_set_pixel(band, 5, 1, 2.8, NULL);
125  rt_band_set_pixel(band, 2, 2, 1.8, NULL);
126  rt_band_set_pixel(band, 3, 2, 1.8, NULL);
127  rt_band_set_pixel(band, 4, 2, 1.8, NULL);
128  rt_band_set_pixel(band, 5, 2, 2.8, NULL);
129  rt_band_set_pixel(band, 6, 2, 2.8, NULL);
130  rt_band_set_pixel(band, 1, 3, 1.8, NULL);
131  rt_band_set_pixel(band, 2, 3, 1.8, NULL);
132  rt_band_set_pixel(band, 6, 3, 2.8, NULL);
133  rt_band_set_pixel(band, 7, 3, 2.8, NULL);
134  rt_band_set_pixel(band, 1, 4, 1.8, NULL);
135  rt_band_set_pixel(band, 2, 4, 1.8, NULL);
136  rt_band_set_pixel(band, 6, 4, 2.8, NULL);
137  rt_band_set_pixel(band, 7, 4, 2.8, NULL);
138  rt_band_set_pixel(band, 1, 5, 1.8, NULL);
139  rt_band_set_pixel(band, 2, 5, 1.8, NULL);
140  rt_band_set_pixel(band, 6, 5, 2.8, NULL);
141  rt_band_set_pixel(band, 7, 5, 2.8, NULL);
142  rt_band_set_pixel(band, 2, 6, 1.8, NULL);
143  rt_band_set_pixel(band, 3, 6, 1.8, NULL);
144  rt_band_set_pixel(band, 4, 6, 1.8, NULL);
145  rt_band_set_pixel(band, 5, 6, 2.8, NULL);
146  rt_band_set_pixel(band, 6, 6, 2.8, NULL);
147  rt_band_set_pixel(band, 3, 7, 1.8, NULL);
148  rt_band_set_pixel(band, 4, 7, 1.8, NULL);
149  rt_band_set_pixel(band, 5, 7, 2.8, NULL);
150 
151  return raster;
152 }
uint16_t rt_band_get_width(rt_band band)
Return width of this band.
Definition: rt_band.c:640
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_raster.c:137
rt_pixtype
Definition: librtcore.h:185
@ PT_32BF
Definition: librtcore.h:195
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's value.
Definition: rt_band.c:974
uint16_t rt_band_get_height(rt_band band)
Return height of this band.
Definition: rt_band.c:649
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)

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

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