1

I am looking for a way in QGIS - preferably using the graphical modeller but console scripting will also do - to build a model that iterates through features of a given layer until a condition is met - a while loop.

Specifically, after manually selecting one feature, I need my model to automatically "select by location" all the features that touch the already selected ones until the sum of a given attribute of the selected features reaches X.

Maybe this image helps:

enter image description here

  • 1
    Loops are currently not possible using Processing but there's certainly a way using a Python script. – underdark Mar 23 '15 at 20:34
  • What about if a certain point two (or more) polygons can be addes/selected and any of them is enough to reach/pass the X limit? What polygon should be added to the selection, the smallest? This question does also apply when the X limit is not almost reached, what polygon should be selected first in case there is more than 1 possible? – Giovanni Manghi Mar 23 '15 at 21:37
  • The model has no preferences - if X = 100 stopping at a selection point where the sum equals 110 or 150 makes no difference for my case. – Lisdengard Mar 24 '15 at 5:19
  • @underdark has this changed in Modeler 3? github.com/qgis/QGIS-Enhancement-Proposals/issues/108 for example – GeorgeC Aug 9 '18 at 0:48

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.