1

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

  • PopID is all zeros in the 2nd file? – Ian Turton May 14 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 May 14 at 14:03
  • PopID long(0,0) looks odd too – Ian Turton May 14 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 May 14 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 May 14 at 14:16
2

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.

  • 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 May 15 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 May 15 at 19:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.