<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">It all depends on the data your having
      gdal_polygonize contour ...<br>
      <br>
      here is a snippet of what I'm doing with a csv I'm creating of
      current weather<br>
      <br>
      /usr/local/bin/gdal_grid -zfield "temp" -a
      invdist:power=2.0:smoothing=1:nodata=-9999 -outsize 800 600 -l
      temp /var/www/html/metar/temp.vrt /var/www/html/metar/temp.tif<br>
      python /usr/local/bin/gdal_polygonize.py
      /var/www/html/metar/temp.tif -f "ESRI Shapefile"
      /var/www/html/metar/temp/temp.shp temp temp<br>
      <br>
      and then the resulting shapefile is used to create the following<br>
      <a class="moz-txt-link-freetext" href="http://www.michiganwxsystem.com/maps/curfore/">http://www.michiganwxsystem.com/maps/curfore/</a><br>
      <br>
      I have messed around with the 'power' and 'smoothing' settings
      these seem the remove the stair steps quite well<br>
      <br>
      <br>
      <pre class="moz-signature" cols="72">-----------------------------------------------------
-Jeff Lake
MichiganWxSystem.com
AllisonHouse.com
TheWeatherCenter.net
GRLevelXStuff.com</pre>
      On 2/19/2013 15:12, Jeff Lacoste wrote:<br>
    </div>
    <blockquote
cite="mid:CAFOE_Bc406dDzoUhAQEQzZQ1C8ZAZhHN10ZT=bnv5_qUT00RNA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Yes visually attractive or smooth polygons is the
        goal. Thanks again Frank.
        <div><br>
        </div>
        <div style="">Doing a web search about simplification algorithm
          i found one named '<b
style="font-size:13px;color:rgb(0,0,0);font-family:sans-serif;line-height:19.1875px">Ramer-Douglas–Peucker'
            (</b><a moz-do-not-send="true"
            href="http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm">http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm</a>).</div>
        <div style="">It appears that 'Geos'' library implement this
          algorithm. Is this algorithm exposed through OGR ?</div>
        <div style=""><br>
        </div>
        <div style="">Could this algorithm help smoothing a polygon
          without necessary make the new nodes too far from the original
          one ? Or may be there</div>
        <div style="">are other *more* recommended algorithms ?</div>
        <div style=""><br>
        </div>
        <div>If any one could suggest a simplification algorithm or had
          some experience with smoothing polygons, I appreciate their
          input.</div>
        <div><br>
        </div>
        <div>Thanks</div>
        <div><br>
        </div>
        <div>Jeff<br>
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Tue, Feb 19, 2013 at 2:42 PM, Frank
          Warmerdam <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="im">On Tue, Feb 19, 2013 at 11:28 AM, Jeff
              Lacoste<br>
              <<a moz-do-not-send="true"
                href="mailto:jefflacostegdal@gmail.com">jefflacostegdal@gmail.com</a>>
              wrote:<br>
              > Hi Frank,<br>
              ><br>
              > Thanks for your quick response. Following the edges
              of the pixels seems a<br>
              > perfect solution for non continuous grid (ex. land
              use, etc.) as<br>
              > the boundary between the class is important to keep
              when constructing the<br>
              > polygon. However for continuous grid (.ex
              elevations), the boundaries are<br>
              > a bit not clear and not clear cut. When following the
              pixels edges, the<br>
              > created polygons appear to have the stairs effect and
              are less visually<br>
              > attractive.<br>
              ><br>
              > I thought of a smoothing the polygons to not have
              *rough* edges using the<br>
              > current gdal_polygonize by trying to not follow the
              pixels edges and use<br>
              > instead of the<br>
              > pixel centers. Basically do something similar to what
              contour generator does<br>
              > by treating the raster values as continuous.<br>
              <br>
            </div>
            Jeff,<br>
            <br>
            Ah, I see, you are looking for visually attractive polygons
            from<br>
            continuous fields.<br>
            <br>
            I have wondered if it would be reasonable to produce a
            version of the<br>
            contour generator that actually produces polygon regions.
             If we had<br>
            that then applying appropriate simplification to the
            resulting very<br>
            detailed edges should give something attractive and with
            reasonable<br>
            information density.  An appropriate simplification
            algorithm might do<br>
            this in a reasonable way for the existing polygonize output
            but I<br>
            don't know enough about the simplification algorithms to
            suggest one.<br>
            <br>
            I don't think aiming for pixel centers in gdal_polygonize
            would really<br>
            solve the problem.<br>
            <div class="HOEnZb">
              <div class="h5"><br>
                Best regards,<br>
                --<br>
---------------------------------------+--------------------------------------<br>
                I set the clouds in motion - turn up   | Frank
                Warmerdam, <a moz-do-not-send="true"
                  href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a><br>
                light and sound - activate the windows | <a
                  moz-do-not-send="true"
                  href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
                and watch the world go round - Rush    | Geospatial
                Software Developer<br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>