2

I'm building a graphical model in QGIS 3.4 to check if a point feature with a specific value in the A field is within a polygon with the same value in B field.

The image displays the draft of the model. enter image description here I set two vector layers as input (point layer and polygon layer), then I added the algorithm "Join attributes by location". After I tried to use "Select by attribute" to compare the attribute values between two fields and I continued adding "Extract selected feature" algorithm.

My issue is in "Select by attribute" part, I don't know what I need to write in the "Value" field or if there are other solutions to compare the value of the two fields. enter image description here

I found this post that uses actions but I prefer Graphical Modeler.

2
  • Are you absolutely locked to QGIS3.4? There would probably be a much easier way to do this with the newer overlay_contains or overlay_within functions. You should be able to use the Extract by expression tool without even having to build a model, I think.
    – Gabriel
    Commented May 12, 2021 at 15:18
  • @GabrielC. at now I'm locked at QGIS 3.4 but it is useful to know that there are these new tools.
    – PaolaB
    Commented May 12, 2021 at 18:15

1 Answer 1

4

Since you need to use QGIS 3.4, I'll stay in the basic modeler. It can be as simple not using the selection algorithms, but rather the Extract by expression algorithm. Selecting features in a model doesn't always work perfectly and since creating new layers in memory doesn't leave a huge mess behind, extracting directly and using that extraction in subsequent algorithms usually works exactly the same way. Only what you actively save to a temporary layer or a file will remain. For your model, you can replicate this one with the following parameters for the Extract:

  • Input layer: The result of Join attributes by location
  • Expression: "FieldA" = "FieldB"
  • Matching features: The layer you want to save

It shouldn't be more complicated than that.

enter image description here

1
  • Thank you! Exactly what I needed.
    – PaolaB
    Commented May 13, 2021 at 6:58

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.