[R-sig-Geo] [FORGED] spsample: random points within a radius r from observed locations

Rolf Turner r.turner at auckland.ac.nz
Tue Oct 27 09:54:22 CET 2015


On 27/10/15 21:37, Gabriele Cozzi wrote:
> Dear list,
>
> I have a set of relocation data (call it pnts).
>
> What I want to do is to create, for each relocation of pnts, n alternative
> relocations within a radius r.
>
> My intuitive approach was to use of the spsample function in the sp
> package.
>
> buffer <- gBuffer(spgeom = pnts, width=r,  byid=T)
> randompoints <- spsample(x=buffer, n=10, type="random", iter=10)
>
> The problem here is that spsample creates 10 random points over all
> Polygons in the buffer object and not for each Polygon within buffer.
>
> Is there a function that returns random locations by passing a
> SpatialPoints-class object to it and a radius r?
>
> Any help is appreciated.

I don't know what is meant by "relocation" data, but I am pretty sure 
that you could easily accomplish your goal using the spatstat package. 
You would have to adjust your terminology and thought patterns somewhat, 
however.

cheers,

Rolf Turner

-- 
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-sig-Geo mailing list