Skip to content
Prev 9367 / 29559 Next

Sampling within distance X from polyline(s)

David Holstius <david.holstius at berkeley.edu> writes:
In the 'spatstat' package, if L is an object of class "psp" (representing a set of line segments) then you can do

       D <- dilation(L, X)     
       P <- runifpoint(N, D)  

The P is your point pattern.
Here 'D' is the morphological dilation of L by distance X (what geographers call a "buffer"). By default this is computed as a pixel image. To get a polygonal approximation you set spatstat.options(gpclib=TRUE)

....
Prof Adrian Baddeley (UWA/CSIRO)
CSIRO Mathematics, Informatics & Statistics
Leeuwin Centre, 65 Brockway Road, Floreat WA 6014, Australia
Tel: 08 9333 6177 | Fax: 08 9333 6121 | Mob: 0410 447 821