I have a polygon grid with 1 square kilometer area cells, and over it a set of points, like so:
What i need to do is select and extract only a single random point per grid cell.
I could do that manually and it wouldn't take too much time as the area i have to cover is not that big, but is there is another way to do this?
Answer
You can easily achieve this using function from processing toolbox:
Take grid cell and join its id (or other unique) attribute to related points - Use Join attributes by location and join unique attribute (i.e. "id_grid") from grid layer to point layer. This create new point layer with new attribute - "id_grid" of corresponding grid.
Select only one point per gird - Use Random selection within subsets. As input choose your new layer from step one, for ID Field select "id_grid" and set number required points to be selected (in your case 1)
Extracting to new point layer - Right click on layer, select Save As..., set output parametres (format, CRS...) and check Save only selected features
No comments:
Post a Comment