简体   繁体   中英

Algorithm for smoothing the edges of a polygon

I use Node.js and Concave hull algorithm for isolating UK postcode sectors. This is what I get for now: 在此处输入图片说明

So now, I need to smooth boundaries to look like this: 在此处输入图片说明

Does anyone have any idea which algorithm should I use?

There seems to be a lots of ways of doing this. I'm inclined to cite some kind of bezier interpolation ( http://www.antigrain.com/research/bezier_interpolation/ ).

@amit gave another great clue about how to solve the problem, splines are actually pretty useful for smoothing polygons. See the related question: https://gis.stackexchange.com/questions/24827/how-to-smooth-the-polygons-in-a-contour-map

Hope it helps!

There are at least 2 approaches to this:

  • Curve fitting algorithms(best for your use case)
  • Rammer-Douglas-Peucker algorithm (simpler to implement)

The Rammer-Douglas-Peucker algorithm reduces the node count of a polygon - this will not smooth it in the sense that it will make it curvy, it will simply reduce the nodes(roughness), whilst struggling to keep the polygon in it's original shape as much as possible

Although what you are, most probably , after is a Curve fitting algorithm through a series of points.

See this answer I've made ( and the answer above, which is more descriptive ) for solutions to this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM