4

I cannot figure out why this join is failing when using the Join attribute be field value tool in QGIS 3.6.

Please see my image below which highlights the two layers attribute table and the criteria used in the tool:

enter image description here

I then get this error saying all features have failed to join:

enter image description here

Some background

  1. The Autoincrimental layer had the PopID field created using the "Add autoincremental field" tool.
  2. Both PopID fields are integers.
  3. The PopID attribute values for the RF layer do not all have a value of zero. I have just ordered them from smallest to largest.

Please see below for the datasets

Dropbox link for test data

8
  • PopID is all zeros in the 2nd file?
    – Ian Turton
    Commented May 14, 2019 at 14:02
  • Sorry should have added that the window doesn't show all of them - there are in fact more which match the numbers in the other layer. I have just ordered them.
    – AWGIS
    Commented May 14, 2019 at 14:03
  • PopID long(0,0) looks odd too
    – Ian Turton
    Commented May 14, 2019 at 14:11
  • Maybe an issue with dealing with multipolygons and multipoints? Perhaps try converting to single polygons and points and try the tool again?
    – Joseph
    Commented May 14, 2019 at 14:13
  • @IanTurton I agree that is strange - the Add autoincremental field does that. Still seems to work on other layers I have tried it on.
    – AWGIS
    Commented May 14, 2019 at 14:16

1 Answer 1

6

Problem is PopID fields are not of the same type.

You can see in layer properties that PopID in Autoincrement layer is "real" and in RF "integer". enter image description here

Algorithm sees "integer" 1 differently than "real" 1 or "string" 1. So, You should convert one of the ID columns. You can do it in field calculator:

enter image description here

This will create new field that you should use to join.

3
  • Thank you for your answer - this is really strange because the examples I used for the screenshot were saved in memory and when I saved them only then was one showing as a real data type. After looking into this it would appear that QGIS does not correctly show the data type in a memory layer until it is saved.
    – AWGIS
    Commented May 15, 2019 at 17:49
  • 1
    I did some tests joining with created incremented field. If you use memory layer it works, if you save it as geopackage it works. Saving it as shapefile it does not since it saves the field as real although it says in export dialog it should be exported as int8. Bug or something over my understanding.. Bottom line, save as geopackage instead of shape (which is not a bad idea in general) or join directly with memory layer.
    – Mat
    Commented May 15, 2019 at 19:03
  • We should also be careful with the length and precision values, as they can get in the way of successfully operating this tool. Commented May 16, 2022 at 14:03

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.