[R-sig-Geo] Sampling point density increasing with distance from a polygon or a line

Rolf Turner r.turner at auckland.ac.nz
Tue Oct 25 23:09:36 CEST 2011


On 26/10/11 02:48, Arnaud Mosnier wrote:
> Dear Geo Users,
>
> I am trying to create "random" points which density decrease with the
> distance from a polygon or a line.
> Is there an function in R that can allow me to do that ?

A combination of functions from the "spatstat" package will
readily allow you to do that.  You will need to form an "im"
object say ``A'', of the distances from the your ``polygon or line'', using
the distmap() function.  You can then generate an inhomogeneous
Poisson process whose intensity is a (decreasing) function of A using the
rpoispp() function.   To calculate the decreasing function of A you would
do something like

     B <- eval.im(1/A)
or
     B <- eval.im(exp(-A))

and then do

     X <- rpoispp(B)

HTH

     cheers,

             Rolf Turner



More information about the R-sig-Geo mailing list