The following polygon/grid should produce coverage fractions that are very close to zero:
auto context = init_geos();
Grid<bounded_extent> ex{{487800, 492800, 5813800, 5818800}, 100, 100};
auto g = GEOSGeom_read_r(context, "POLYGON ((492094.9283999996 5816959.8553, 492374.9335527361 5816811.352641133, 492374.9335527363 5816811.352641133, 492094.9283999996 5816959.8553)))");
auto result = raster_cell_intersection(ex, context, g.get());
Instead it produces coverage fractions that are very close to one. It looks like this happens because the addition of calculated intersection points where the polygon crosses cell boundaries actually causes the polygon to flip from CCW to CW orientation.
The following polygon/grid should produce coverage fractions that are very close to zero:
Instead it produces coverage fractions that are very close to one. It looks like this happens because the addition of calculated intersection points where the polygon crosses cell boundaries actually causes the polygon to flip from CCW to CW orientation.