Hi Frank, Thanks for your quick response. Following the edges of the pixels seems a perfect solution for non continuous grid (ex. land use, etc.) as the boundary between the class is important to keep when constructing the polygon. However for continuous grid (.ex elevations), the boundaries are a bit not clear and not clear cut. When following the pixels edges, the created polygons appear to have the stairs effect and are less visually attractive.
I thought of a smoothing the polygons to not have *rough* edges using the current gdal_polygonize by trying to not follow the pixels edges and use instead of the pixel centers. Basically do something similar to what contour generator does by treating the raster values as continuous. Thanks On Tue, Feb 19, 2013 at 1:44 PM, Frank Warmerdam <warmer...@pobox.com>wrote: > On Tue, Feb 19, 2013 at 10:29 AM, Jeff Lacoste > <jefflacosteg...@gmail.com> wrote: > > Hi, > > > > I'm using gdal_polygonize.py to create polygon from a grid and the output > > polygons seems to follow the edges > > of the grid pixels. I was wondering if there is any way to change/edit > the > > code to instead of following the edges > > of the pixels, use the center of the pixels as the nodes of the created > > polygons ? > > > > So instead of a polygon following the edges of the pixels, it will > instead > > be passing through the center of the connected > > pixels... This is to avoid having a scale effect of following the pixels > > edges. > > Jeff, > > With the current algorithm, this is not really possible. > > I am also not clear what it would mean to go from pixel center to > pixel center. The algorithm attempts to identify the borders between > regions of different pixel values and turn them into polygons. What > does it mean to make a polygon boundary that goes through the center > of a pixel with a particular value? > > Another algorithm you might want to keep in mind is the contour > generator. It treats the the raster values as a continuous field, and > builds edges based on linear interpolation between pixel centers. > This gives a result that could pass through a pixel center if it > happens to be an exact contour level. > > Best regards, > -- > > ---------------------------------------+-------------------------------------- > I set the clouds in motion - turn up | Frank Warmerdam, > warmer...@pobox.com > light and sound - activate the windows | http://pobox.com/~warmerdam > and watch the world go round - Rush | Geospatial Software Developer >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev