[GIS] in QGIS how to add (join?) another table to a layer

dbfqgisrelatesshapefiletiger

Very new so bear with me. I have QGIS loaded with a TIGER/Line Shapefile at the Block level for a County, and need to join other detailed CENSUS data various tables (which also have a Block ID to relate on) so I can see more columns in the layer attribute table, and work with those.

What's the best approach? Do I open the original shapefile set .dbf table , relate, add columns as needed, output as a "sweetened" .dbf and then import again to QGIS? Or can I relate another local geodatabase table (with only an ID, no other lat/long info) right inside QGIS?

Any thoughts on what a good data format would be best (.xls, csv, tab/text, .xml, etc.) for that second table?

I see other posts re: csv joins but wondered if that's the best way to go here?

Best Answer

You've got a few options here. QGIS can natively open and process from CSV files so if your data is already in that format, you should be fine. Otherwise, you can export it to that format or install a plugin called "Spreadsheet Layers" from the Plugins Manager. There isn't really any major benefits between spreadsheet file types, just use what's simplest for you.

To join the data, you want to first verify that you have the Processing Toolbox is open and that you have the "advanced interface" is selected from the drop-down menu in the bottom of it. From there, all you need to do is write in the search toolbox field "Join Attributes Table" and run it. The Input layer should be your TIGER data and the table layer should be your CSV/.xlsx/.ods; your table fields should refer to the Block IDs. You can save the resulting file permanently by giving it a name and specifying where you want to save it.

The end result will be a new shapefile with the joined table. If you want to simply extract the table from that new shapefile, you can export the .dbf to CSV/etc. or you can save the shapefile (or export it to whatever you need).

A great tutorial for this specifically can be found here: http://www.qgistutorials.com/en/docs/performing_table_joins.html

Hope that helps!

Related Question