qgis basics for journalists
Join data to a map
Whew. Still with me? Good — we're getting to the important stuff.
One of the main reasons journalists are interested in data mapping is to analyze data for a story. To do that, we need to join a spreadsheet to a map layer's database file. That happens inside QGIS.
QGIS is supposed to be able to join a CSV file or another DBF file. I occasionally have problems working with CSVs and have developed the habit of opening them in OpenOffice and saving as a DBF. OpenOffice is free, open source and works on Mac, Windows and Linux. I've yet to have a DBF fail when I prepared it properly.
Formatting the data
This exercise will add census housing information to the clipped shape file you just made. Here's a look at the data.
Notice that the first column is GEO_ID and it matches the GEOID10 column in our map file. Joins match two columns in different databases.The join will fail if there are any irregularities. It happens a lot so patience is required. But using standards like FIPS reduces errors considerably.
Go to the Vector menu and select Data Management Tools and select Join attributes. When you select the DBF option, QGIS will ask you to locate the file. Navigate to the data folder and select data-join.dbf. Set up the Outut shapefile the same way it was described in the Edit Vector Maps section. The window should be set up like the example below.
Once you've clicked OK and processed the Join, close the window and open the clipped layer's Attribute table. Scroll to the right until you see the new data:
Save your work.
Changes in Version 1.7: There were substantial changes to joining data. Go to the Layer menu and select Add Vector Layer. Navigate to the data files and open data-join.dbf (Confession: I'm not sure why this works but it does). This will add the file to your layers menu. Next, open the Layer Properties and select the Joins tab. Click the plus (+) sign and match the data the way we did above.