jeudi 25 juillet 2019

Stratified Random Sampling of Points in Polygon depending on Buffer-Mean around the sampled Point (preferably sf-package)

I have to randomly sample 100 spatial points in a spatial polygon. But the random sampled points should be allocated depending on another (underlying shp file) variable.

In other words: I have a country (1st shp file) and a (2nd) shp file with 250x250 grids of the country (which has holes in it as not all are populated). I now have to randomly drop 100 points (within the boundaries of the country and not necessarily within the boundaries of the grid-shp), BUT when drawing a 2km buffer around those points, I have to have at least a certain amount of inhabitants (this information is only in the grid-shp) in the buffer.

I manage to sample the points within the polygon, but did not manage to do this conditioning on the amount of people that should (at least) fall into the buffer.

I am working with the sf package (but did neither find it in the sp). I did randomly distribute the sample with st_sample, and then drew a buffer around with st_buffer. But I haven't manage to find a sampling command which helps me stratifying (?) depending on the inhabitants around this point.

My result should be, that I have 100 spatial points, each of them having at least a certain amount of inhabitants in its buffer.




Aucun commentaire:

Enregistrer un commentaire