I have a geotiff file, which, for each cell ( pixel), it contains a discrete value ( you can think of this value as the "fitness" value of the cell). For the neighboring cells, they can consist of the same discrete value, but not always.
I want to create a polygon for all the adjacent cells that share the same discrete value. A polygon is defined by the following usual class ( in pseudo code)
class Point
{
double X;
double Y;
}
class Polygon
{
List<Point> Pts;
}
The reason for this is that, for my rendering engine, I would rather render a few large polygons, rather than all the individual raster cells one by one for performance consideration.
I believe that GDALPolygonize is the way to go. However I don't quite know how to turn the output from the function into a list of Polygons that I can use.
The example from the cookbook straightaway makes use of a library to render the output file, which is not suitable for my purpose.
I mainly working with GDAL ( C++) or GDAL.Net (C#), but examples in other languages are acceptable as the syntax is quite close with C++ version.
Or is there other, more direct method that I can use, both in or out of GDAL?
OGRFeature
refers to one polygon? Because this is the impression I get when I play with the API...