1

I have built a model which requires a range of integers between 0 - 13 as an input. I am using two different Number parameter inputs, Minimum and Maximum, which works, but is somewhat awkward because the Number input is not an integer.

I have seen that there is a Range input available, which looks like a better fit, but I do not seem to be able to access the values of the input from algorithms.

Examples below, showing behaviour of Number vs Range parameter inputs

Input GUI of Number parameters vs Range parameter Input GUI of Number parameters vs Range parameter

Model builder - can't choose a Range value as input Model builder - can't choose a Range value as input, only the Minimum and Maximum Number inputs

  • As you've discovered, it appears that the extract by attribute algorithm doesn't accept a range as input. You'll have to run extract by attribute twice, once with the minimum and once with the maximum. – csk Jun 6 at 17:57
  • Yes, that is what I currently do (running once against the Minimum, then again against the Maximum Number inputs). What I am wondering is if there is anyway to access the min and max from Range input, as I prefer the UI for the Range input. In fact I haven't found any algorithms at all which accept a Range input. – TimD Jun 7 at 3:36
  • I did a bit of testing in the modeler. The extract by attribute algorithm is a dead end; it's definitely not setup to accept a range as input. The extract by expression algorithm seems more promising. I'm thinking of an expression that uses the parameter('myrange') function (where 'myrange' is the name of the range input) to call the range input. Where I'm stuck is finding a way to test if the field value of the current geometry object is within that range. The IN operator requires a list of values, rather than a range. – csk Jun 7 at 16:43
  • FYI, the r.rescale algorithm accepts a range as input. So there's at least one algorithm that does. – csk Jun 7 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.