3

I'm trying to calculate and output a virtual field -- something that is a straightforward function of fields from a vector layer in QGIS 3. The FieldCalculator does the trick, but I need to manually specify parameters (e.g. coefficients in the function).

That's easy via FieldCalculator, but if I want others to use this calculation, what's the easiest way to prompt the user to input parameters?

A plugin seems like overkill for something this simple.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Dec 15, 2020 at 1:39

1 Answer 1

4

You can use the QGIS Model Designer for that, which is a powerful tool to make input dialogs for such tasks. Also the field calculator is available within the Model Designer:

enter image description here

The example above takes a vector layer and two numerical inputs and makes the sum of the two numerical inputs and write it into the field NewField, not very complex but shows the possibilities:

enter image description here

here is is a small video which explains the steps above: https://files.wheregroup.com/index.php/s/dKnZRibgymAe6oM

answered Dec 15, 2020 at 7:00
2
  • This looks like a great way to go, but I am having trouble A) understanding how to wire up the components, and B) finding time over my last few days crises to get it working. Any pointers to "how to's" or other such things would be greatly appreciated. Commented Dec 20, 2020 at 0:41
  • I added a link to a small video to the post above, hope this helps Commented Dec 20, 2020 at 18:33

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.