Skip to content

How to randomly select points in a polygon

2 messages · Yong Li, Edzer Pebesma

#
I want to overlay points with a polygon, get the points in the 
polygon and then try to just select a point randomly from them.
I have tried using overlay, but it did not give me what I really 
want. Any help will be appreciated.

Yong
#
You may want to use spsample, or, if you selected the points in the 
polygon with overlay and want to sample from them, use function sample.

It is hard for us to see what you're trying and cannot get without 
(reproducible) example code.
--
Edzer
Yong Li wrote: