[R-sig-Geo] simplify a polygon window
Colin Rundel
rundel at gmail.com
Fri Oct 5 03:44:27 CEST 2012
The gSimplify function in rgeos wraps geos' implemention of the Douglas-Peucker algorithm so it should be easy to try it out for this particular problem, the topologyPreserve argument may also help (the geos documentation doesn't mention the specific implementation differences between the two algorithms but both are worth trying).
One additional option is to play with gBuffer to simplify the polygon by expanding the polygon by a small amount and then shrinking by a slightly smaller amount.
-Colin
On Oct 4, 2012, at 6:42 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
> This seems to me to be a hard problem; it is one with which I have struggled
> off and on over the years with minimal success. The simplify.owin() function
> is a fairly blunt instrument with which to attack the problem. There exists a
> somewhat sexier algorithm:
>
> Douglas, D. H. and Peucker, T. K., 1973. Algorithms for the Reduction
> of the Number of Points Required to Represent a Digitised Line
> or its Caricature, The Canadian Cartographer, 10(2): 112-122.
>
> This is relatively easy to implement but for complicated boundaries it often
> introduces self-intersections, which is no good at all.
>
> A paper by Shin-Ting Wu and Mercedes Gonzales Marquez (2003) describes
> a clever way of getting around the self-intersection. They wrote C++ code
> to implement their algorithm and kindly gave me permission to use their code and
> incorporate it into an R function. Sad to say I never got around to doing this. Your
> inquiry has reawakened my interest in this problem and I may shift it off the back-burner.
> However it is very likely to take me quite a while to get the necessary work done,
> even if the Wu-Marquez code is still available (which it may not be). I am currently
> making enquiries.
>
> Overall there doesn't seem much that I can suggest to help you with your immediate
> problem. Sorry 'bout that.
>
> cheers,
>
> Rolf Turner
More information about the R-sig-Geo
mailing list