155 {
156 int i;
158 int nPols = 0;
159 double total_area = 0;
160 double total_val = 0;
163
164
167
168 nPols = 0;
170 CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
171 total_area = 0; total_val = 0;
172 for (i = 0; i < nPols; i++) {
173 total_val += gv[i].
val;
174 gobserved = (
LWGEOM *) gv[i].geom;
177 }
178 printf("total area, total val, nPols = %f, %f, %i\n", total_area, total_val, nPols);
179 CU_ASSERT_DOUBLE_EQUAL(total_val, 1.8 + 0.0 + 2.8 + 0, FLT_EPSILON);
180 CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
181
184
185
187
188
190
191 nPols = 0;
193 CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
194 total_area = 0; total_val = 0;
195 for (i = 0; i < nPols; i++) {
196 total_val += gv[i].
val;
197 gobserved = (
LWGEOM *) gv[i].geom;
200 }
201 printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
202 CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
203 CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
204
205
208
209
211
212
214
215 nPols = 0;
217 CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
218 total_area = 0; total_val = 0;
219 for (i = 0; i < nPols; i++) {
220 total_val += gv[i].
val;
221 gobserved = (
LWGEOM *) gv[i].geom;
224 }
225
226 printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
227 CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
228 CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
229
232
233
235
237
238 nPols = 0;
240
241 CU_ASSERT_DOUBLE_EQUAL(nPols, 2, FLT_EPSILON);
242 total_area = 0; total_val = 0;
243 for (i = 0; i < nPols; i++) {
244 total_val += gv[i].
val;
245 gobserved = (
LWGEOM *) gv[i].geom;
248 }
249
250 printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
251 CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
252 CU_ASSERT_DOUBLE_EQUAL(total_area, 28, FLT_EPSILON);
253
256
257
259
261
262 nPols = 0;
264
265 CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
266 total_area = 0; total_val = 0;
267 for (i = 0; i < nPols; i++) {
268 total_val += gv[i].
val;
269 gobserved = (
LWGEOM *) gv[i].geom;
272 }
273
274 printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
275 CU_ASSERT_DOUBLE_EQUAL(total_val, 1.8 + 0.0 + 2.8 + 0.0, FLT_EPSILON);
276 CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
279}
static rt_raster fillRasterToPolygonize(int hasnodata, double nodataval)
void lwgeom_free(LWGEOM *geom)
double lwgeom_area(const LWGEOM *geom)
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
rt_geomval rt_raster_gdal_polygonize(rt_raster raster, int nband, int exclude_nodata_value, int *pnElements)
Returns a set of "geomval" value, one for each group of pixel sharing the same value for the provided...
void rtdealloc(void *mem)
void cu_free_raster(rt_raster raster)