[R] Problem with polygon vertices

Rolf Turner rolf.turner at xtra.co.nz
Mon Nov 5 01:56:33 CET 2012


On 05/11/12 13:13, Luis Iván Ortiz Valencia wrote:
> I am building a mask with
> area.urb.sp.W <- as(area.urb.sp, "owin")
>
> and got the message
> Erro em owin(poly = opls) :
>    Polygon data contain duplicated vertices, self-intersection and overlaps
> between polygons
>
> how can I solve this problem in R?
>
> many thanks

Basically you need to examine "area.urb.sp" carefully and amend
it so that it doesn't have duplicated vertices, self-intersection, and
overlaps.

This can be difficult, especially if the boundaries of the polygons
involved have a large number of edges.

You *could* set

     spatstat.options(checkpolygons=FALSE)

but this is not advised.  The "owin" object you wind up with will in
general be nonsensical.  Doing this, and plotting the result might
give you some insight as to what needs to be fixed.  But *do* fix
it. Don't just go with the nonsensical window.  This would cause any
further analyses to yield nonsense.  Garbage in, garbage out.

     cheers,

         Rolf Turner




More information about the R-help mailing list