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?

  • Could you provide some more information: what version of qgis, error message or result output? After running the tool and you don't get any errors, it should be fine. Cross check the by opening the attribute table, the header would show you how many were selected. You should check that you chose the right input layer and you clicked all the right fields of the tool.
    – mapperx
    Mar 29, 2017 at 17:49
  • is it selecting nothing, or is it selecting everything? is your latitude field a float/real number, that might cause problems?
    – Steven Kay
    Mar 29, 2017 at 19:22
  • Thanks for your prompt reply, much appreciated. I have updated the post and added the requested information. Sorry for not being detailed enough - I'm new to this game. Thanks for trying to help :)!
    – AstridH
    Mar 30, 2017 at 8:12
  • "The percentage/count value is not applied to the whole layer, but instead to each category. Categories are defined according to a given attribute, which is also specified as an input parameter for the algorithm." - not sure you need this method. Here is an example of using the 'Random selection within subset'. I believe you need to use 'Random selection' method for this task. Mar 30, 2017 at 8:42
  • Thanks for reply Mykola! I seem to have the same issue there, i.e. the process runs, finishes and nothing else happens. I tried it now on a different layer with float numbers and there it seem to work. So, I assume Steven was right when he suggested the float/real number could cause problems. Any ideas on how I can tackle this problem?
    – AstridH
    Mar 30, 2017 at 9:02

1 Answer 1


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.
  • Thanks Paulo! This is kind of similar to how I solved it at the end :)! Thanks for your help!
    – AstridH
    Apr 2, 2017 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.