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

Gabriele Cozzi gab.cozzi at gmail.com
Tue Oct 27 09:37:58 CET 2015


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.

Gabriele



-- 
Gabriele Cozzi
Postdoctoral Research Associate
Population Ecology Research Group
http://www.popecol.org

Zurich University
Institute of Evolutionary Biology and Environmental Studies
Winterthurerstr. 190
8057 Zurich - Switzerland
E-mail: gabriele.cozzi at uzh.ch
Office: 34-J-38
Phone: +41(0)44 635 47 56
Fax: +41(0)16355711
http://www.ieu.uzh.ch

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list