Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

New user. This should be simple, but I can't figure out how to perform this basic join in QGIS. (It works in Cartographica.)

My shapefile (IL_BNDY_County_Py) has two fields/columns in its attribute table: COUNTY_NAM and CO_FIPS.

My source DBF file (IL_BNDY_County_Py-species-dbf4.dbf) has three fields/columns: COUNTY_NAM, CO_FIPS and SPECIES. (The file is a literal clone of the shapefile table, with the addition of "SPECIES".)

Both are available as layers in my project.

I want to add the SPECIES field to the shapefile. Either COUNTY_NAM or CO_FIPS could serve as "key" field (to use terminology I'm familiar with from other software).

When I try to create a join, the Add vector join dialog shows the following options:

Join layer: IL_BNDY_County_Py-species-dbf4.dbf

Join field: (three menu options): COUNTY_NAM, CO_FIPS or SPECIES

Target field (two menu options): COUNTY_NAM or CO_FIPS

Is this what I should be seeing?

I can't figure out how to use this dialog to get the SPECIES field added to the shapefile. Part of the problem is that QGIS doesn't use the the term "key," so it's impossible for me to know which field QGIS wants to use to ensure the relationship. Given the options displayed, neither the "target" nor "join" field seems appropriate to serve as "key." How do I denote the "key" field?

If I choose SPECIES as the Join field, and CO_FIPS as the Target field, the results are duplicate columns for COUNTY_NAM and CO_FIPS with random mix of integer values and NULL values. SPECIES values are ignored and not copied over. I even tried creating a placeholder "species" column in the shapefile attribute table but still couldn't figure out how to get SPECIES copied over to species. What is the proper procedure for doing this? Is there another problem that I should be considering?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Select CO_FIPS as join and target field. That should do the trick.

The dialog basically just asks you which field in the first table should equal which field in the second table.

share|improve this answer
    
Thanks. That worked, but it also added a duplicate COUNTY_NAM field to the target table. Why? Is that normal behavior for QGIS? Seems wrong. –  syncrasy Mar 3 '13 at 17:25
    
It's normal, all fields are copied over to the first table. –  underdark Mar 3 '13 at 17:27
    
Please upvote helpful answers and accept answers that solve your problem. –  underdark Mar 3 '13 at 17:28
    
Ahh, of course. My mental map was wrong. Thank you. –  syncrasy Mar 3 '13 at 17:31
    
Upvoted and accepted. (I wasn't able to upvote earlier. Apparently one must have a reputation to upvote, and I didn't have a reputation.) –  syncrasy Mar 3 '13 at 19:11
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.