Reputation: 123
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?
Upvotes: 2
Views: 3370
Reputation: 22959
There are at least 2 approaches to this:
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.
Upvotes: 1
Reputation: 2585
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!
Upvotes: 1