Skip to content
Prev 24013 / 29559 Next

removing internal boundaries from a spatstat window that was created from three adjacent counties

On 13/02/16 11:59, Christopher W. Ryan wrote:

            
I think it probable that your owin object has come out as a multiple 
polygon.  Look at length(sremsWindow$bdry) --- this is probably 3 (or more).

I would guess that the internal boundaries actually consist of *pairs*
of closely juxtaposed lines --- which look like single lines when plotted.

Have you read the spatstat vignette "shapefiles"?  That might give you 
some guidance as to how to proceed.

I would have thought the automatic repair process that spatstat now uses 
would fix up this problem.  What version of spatstat are you using?

You *might* be able to fix things up by doing (something like):

W1 <- owin(poly=sremsWindow$bdry[[1]])
W2 <- owin(poly=sremsWindow$bdry[[2]])
W3 <- owin(poly=sremsWindow$bdry[[3]])

W  <- union.owin(W1,W2,W3)

But if my guess about the internal boundaries actually being pairs of 
line is correct, this may not work.

It's hard to say without having your sremsWindow object to experiment on.

Or perhaps you need to extract the three counties separately as owin
objects and the apply union.owin() to the three results.  (Again, if my 
guess is correct, this may not work.)

Adrian or Ege may be able to propose a more efficient/effective solution.

cheers,

Rolf Turner