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

◆ fillRasterToPolygonize()

static rt_raster fillRasterToPolygonize ( int  hasnodata,
double  nodataval 
)
static

Definition at line 102 of file cu_gdal.c.

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

References cu_add_band(), PT_32BF, rt_band_get_height(), rt_band_get_width(), rt_band_set_pixel(), rt_raster_new(), and rt_raster_set_scale().

Referenced by test_gdal_polygonize(), and test_gdal_polygonize_interrupt().

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