[gdal-dev] gdal_polygonize and polygon edges
Jeff Lake
admin at michiganwxsystem.com
Tue Feb 19 12:31:52 PST 2013
It all depends on the data your having gdal_polygonize contour ...
here is a snippet of what I'm doing with a csv I'm creating of current
weather
/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
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
and then the resulting shapefile is used to create the following
http://www.michiganwxsystem.com/maps/curfore/
I have messed around with the 'power' and 'smoothing' settings these
seem the remove the stair steps quite well
-----------------------------------------------------
-Jeff Lake
MichiganWxSystem.com
AllisonHouse.com
TheWeatherCenter.net
GRLevelXStuff.com
On 2/19/2013 15:12, Jeff Lacoste 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
> <mailto:warmerdam at pobox.com>> wrote:
>
> On Tue, Feb 19, 2013 at 11:28 AM, Jeff Lacoste
> <jefflacostegdal at gmail.com <mailto: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 <mailto:warmerdam at pobox.com>
> light and sound - activate the windows |
> http://pobox.com/~warmerdam <http://pobox.com/%7Ewarmerdam>
> and watch the world go round - Rush | Geospatial Software Developer
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130219/4a4dcdab/attachment.html>
More information about the gdal-dev
mailing list