4

I am trying to join a .csv onto shapefile data. This csv file is a non-geometric file. When I go to join the two, the shapefile reads that the columns are null. Both files have matching columns.

I saved another file with the same name as a .csvt ("String","Integer","Real"), but nothing seemed to work. In my .csv I have a total of three columns: text, number, %.

I am operating on QGIS 2.8.

Shapefile: enter image description here

CSV: enter image description here

  • 1
    Can you show us a sample of the tabular data from the csv and shapefile? It's hard to know what's going on without more detail. – lambertj Jul 2 at 22:05
  • I added pictures – BroadwayJoe16 Jul 2 at 22:34
  • I guess your matching fields should be "COUNTY_NAM" and "County". Be aware that "County" is all uppercase, so it is technically not identical to "COUNTY_NAM". (I would also suggest to upgrade to at least 2.18 if possible) – MrXsquared Jul 2 at 22:56
  • 1
    The problem could be that the information in the shapefile´s attribute table is title case (Upper and lower case characters). In the external database information of the County field is all in upper case. For any GIS ADAM is not equal to Adams, therefore you will have a null result of the join operation. You need that in both fields, since you are using a string field, is captured the same way, both uppercase (ADAMS=ADAMS) or title case (Adams=Adams) – Gerardo Jimenez Jul 3 at 1:13
  • 1
    In addition to capitalization, if one or more blank spaces exist in one of the table's records, but don't exist in the other table, the join will fail. – Stu Smith Jul 3 at 5:05
6

as the above people commented, the problem is that you are trying to join uppercase attribute values in the csv with non-uppercase attribute values in the geometries attribute table. Using the field calculator you can either update your COUNTY_NAM field to uppercase by setting it to

upper(  "COUNTY_NAM " )

or create a new field to use for the join.

1

Column heading capitalization should not affect the join. Try renaming the %Margin column in your csv to PctMargin. Also, remove the % symbol from the end of that columns values. Non-alphanumeric characters can cause problems.

  • But the attribute capitalization WOULD affect the join, right? I think 2 things are going on here...issues with field headings being joined and also with the attributes being matched. – bwilkes Jul 10 at 13:08
  • 1
    Yes. The contents of the columns the join is based on should have identical fields, which would include capitalization. The headings, however, can be different names, different spelling, different capitalization. – Don Meltz Jul 12 at 1:28

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.