[GIS] Random selection within subset

pointqgisrandomselect

I'm working in QGIS 2.18.3.

I have point layer which represents GPS points along a transect line. I would like to randomly select 5 points along this transect, i.e. from this layer.

Somehow I expected this to be straight forward, but I seem to miss something here.

I used Research Tools –> Random selection within subset, selected the transect as input layer, Latitude as ID Field (Latitude = Real), Number of selected features (for the count instead of percentage) and entered 5 as number of selected features.

After pressing "Run" the process runs without problems as the process bar proceeds to 100%, then closes and I receive no error message.

However, nothing has been selected, i.e. no 5 points are highlighted in the attribute table (header still shows selected=0).

Am I using the function in a wrong way or do I expect the wrong output?

Best Answer

One way to do this might be to:

  • export your subset to another layer
  • add a field to the attribute table, type float
  • calculate random numbers using the Field Calculator for each cell
  • pick the 5 highest (or lowest) numbers.
Related Question