2

When I import a CSV file of census data, the length and precision of all of the fields are zero.

enter image description here

As a result, when I try to join the census data with a TIGER file of corresponding census block groups, the joined fields are "NULL."

enter image description here

How do I prepare the CSV file for an effective join?

Both the data of the CSV file and the field on which the join is based are in the TIGER file are string format.

Matt
19.4k4 gold badges25 silver badges64 bronze badges
asked Apr 11, 2020 at 1:51
3
  • Are the length and precision really 0? When creating an attribute 0 means maximum (254 for a shapefile for example) Commented Apr 11, 2020 at 5:20
  • 2
    Welcome to GIS.SE! CSVs always have a length and precision of 0 when dragged and dropped into QGIS - the format doesn't allow for such a definition (and all data is imported as strings so precision is irrelevant). The reason why your join isn't working is likely to be some other issue. I just tried joining a CSV I dragged in with 0 length and precision for all the fields, but had no problem joining the data. My first suggestion would be to check if your CSV join field has any leading or trailing spaces, or other characters (like an apostrophe ' before the text if handled in Excel). Commented Apr 11, 2020 at 9:35
  • 2
    Also, if the CSV file was saved in Excel and the join field is a series of numbers with more than 15 digits, check that the numbers do actually match with your TIGER file - because Excel will convert the 16th digit onwards to zeroes unless specified as text Commented Apr 11, 2020 at 9:46

1 Answer 1

1

If you want to specify field types and precision you would need to create a companion csvt file. It's actually quite simple.

This primer should get you started.

answered Oct 3, 2021 at 2:22

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.