[gdal-dev] gdal_polygonize and polygon edges

Frank Warmerdam warmerdam at pobox.com
Tue Feb 19 12:25:11 PST 2013


Jeff,

I believe this is exposed in ogr2ogr using the -simplify argument:

-simplify tolerance:
(starting with GDAL 1.9.0) distance tolerance for simplification.
Note: the algorithm used preserves topology per feature, in particular
for polygon geometries, but not for a whole layer.

Best regards,
Frank

On Tue, Feb 19, 2013 at 12:12 PM, Jeff Lacoste
<jefflacostegdal at gmail.com> wrote:
> Yes visually attractive or smooth polygons is the goal. Thanks again Frank.
>
> Doing a web search about simplification algorithm i found one named
> 'Ramer-Douglas–Peucker'
> (http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm).
> It appears that 'Geos'' library implement this algorithm. Is this algorithm
> exposed through OGR ?
>
> Could this algorithm help smoothing a polygon without necessary make the new
> nodes too far from the original one ? Or may be there
> are other *more* recommended algorithms ?
>
> If any one could suggest a simplification algorithm or had some experience
> with smoothing polygons, I appreciate their input.
>
> Thanks
>
> Jeff
>
>
>
>
> On Tue, Feb 19, 2013 at 2:42 PM, Frank Warmerdam <warmerdam at pobox.com>
> wrote:
>>
>> On Tue, Feb 19, 2013 at 11:28 AM, Jeff Lacoste
>> <jefflacostegdal at gmail.com> wrote:
>> > 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.
>>
>> Jeff,
>>
>> Ah, I see, you are looking for visually attractive polygons from
>> continuous fields.
>>
>> I have wondered if it would be reasonable to produce a version of the
>> contour generator that actually produces polygon regions.  If we had
>> that then applying appropriate simplification to the resulting very
>> detailed edges should give something attractive and with reasonable
>> information density.  An appropriate simplification algorithm might do
>> this in a reasonable way for the existing polygonize output but I
>> don't know enough about the simplification algorithms to suggest one.
>>
>> I don't think aiming for pixel centers in gdal_polygonize would really
>> solve the problem.
>>
>> Best regards,
>> --
>>
>> ---------------------------------------+--------------------------------------
>> I set the clouds in motion - turn up   | Frank Warmerdam,
>> warmerdam at pobox.com
>> light and sound - activate the windows | http://pobox.com/~warmerdam
>> and watch the world go round - Rush    | Geospatial Software Developer
>
>



--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer


More information about the gdal-dev mailing list