[R-sig-Geo] Sampling within distance X from polyline(s)
Adrian.Baddeley at csiro.au
Adrian.Baddeley at csiro.au
Tue Sep 21 09:49:20 CEST 2010
David Holstius <david.holstius at berkeley.edu> writes:
> What is a good way to spatially sample N points of distance less than
> X from a given polyline?
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
More information about the R-sig-Geo
mailing list