[R-sig-Geo] Dilation and Window Definition in Spatstat

Rolf Turner r.turner at auckland.ac.nz
Fri Nov 1 00:48:45 CET 2013


It is hard to tell without reproducible code, but I suspect (since you 
use the word
"dilate") that you have used the function dilation() and are not getting 
the window
that you think you are getting.  Try:

     W <- owin(poly=as.owin(demopat)$bdry[[1]])
     WD <- dilation(W,100)
     set.seed(42)
     X <- runifpoint(100,WD)
     plot(X)

and you will see what I mean.

You *probably* want to use expand.owin().

     cheers,

     Rolf Turner

On 11/01/13 04:40, Ted Rosenbaum wrote:
> I am using spatstat version 1.34-0 and the pop command is not correctly
> recognizing the interior of a window after I use the dilation command on a
> polygon (i.e., non rectanglular window).
>
> I have window that is a convex hull of the lower 48 states.  I have a set
> of points that are county centroids.  When I make a point pattern (pop)
> using that window, I get expected results (all points, except for some that
> are on a boundary are in the window).  In order to expand the window to
> include those points, I dilate the window with the convex hull by a small
> amount.  After the dilation, I make a point pattern and am informed that
> only one point remains in the window.  Since, as far as I understand it, a
> dilation should only expand the set of points in the window, this should
> not happen.
>
> I apologize for not providing replicable code, but I was having trouble
> creating a polygon to replicate the issue.  If someone needs code to help
> troubleshoot, I can email you some files with code offline.



More information about the R-sig-Geo mailing list