Joining Non-Geospatial Data
At times it may be necessary to add data to an existing layer by cross-referencing that data with another table. Cartographica does this by matching columns in an existing layer with data from a file and adding the new data to features which match. This operation is called a join in database parlance and by some GIS packages.
To join data, use the Map To
column to specify the destination column for the imported data (or New Column
if you want to add a new column for the imported data). Matching criteria is specified by checking the Key
box next to a column. Checking more than one Key
box will only add the data when all Key fields match.
As an example, here is some existing Polygonal data (Example Data A) for three Counties that exist in two different States:
County Name | State Name | Area (Sq KM) |
---|---|---|
Floyd | Kentucky | 1,020 |
Loudon | Virginia | 1,347 |
Floyd | Virginia | 989 |
Note that Floyd counties exist in both states
Here is the data you want to join with the above data (Example Data B):
County Name | State Name | 1990 Census Population | 2000 Census Population |
---|---|---|---|
Barren | Kentucky | 38,033 | 30,033 |
Adair | Iowa | 8,243 | 8,244 |
Floyd | Kentucky | 42,441 | 40,441 |
Fairfax | Virginia | 1,077,000 | 1,099,000 |
Loudon | Virginia | 169,599 | 269,599 |
Here is the result of performing the Join of Example Data B to Example Data A using County Name and State Name columns as keys:
County Name | State Name | Area | 1990 Census Population | 2000 Census Population |
---|---|---|---|---|
Floyd | Kentucky | 1,020 | 42,441 | 40,441 |
Loudon | Virginia | 1,347 | 169,599 | 269,599 |
Floyd | Virginia | 989 |
In the final table, the extraneous data supplied in Example Data B \(Adair, Iowa and Barren, Kentucky) which did not match entries in the existing table is discarded. Further, the lack of data about Floyd, Virginia resulted in empty columns.
Note that if only the County Name was used as a key and all other columns were matched, then both Floyd counties \(the one in Virginia and the one in Kentucky would have values set in all columns, including replacing the State Name column. However, the explicit use of a multiple key means that Cartographica will only consider a match when all elements match.
County Name | State Name | Area | 1990 Census Population |
---|---|---|---|
Floyd | Kentucky | 1,020 | 42,441 |
Loudon | Virginia | 1,347 | 169,599 |
Floyd | Kentucky | 989 | 42,441 |
In the case that a feature in the layer matches multiple rows in the joined table, each row from the table will replace columns in succession, resulting in the final feature data matching the last matching row in the table.