I want to "merge" two layers and export the resulting table of attributes into a csv file. The two layers are as follows:

  1. MSA level information: It has geometric information that creates the polygons and attributes of the MSAs. For some MSAs, some attributes are NULL, for others there is a string.
  2. County level information: It has geometric information at the county level (to generate the polygons) and attributes at the same level. As before, the attributes are "NULL" for some cells and strings for others.

When selecting the two layers, the overlapping map is perfect. However, when I try to use "Join Attributes by Location", the layers are merged but only the geometric information is saved, and the attributes are lost. If I use MMQGIS to do a "Spatial Join" of the two layers, I get an error message saying that there are "duplicate output field names from different layers", which is true as all geographic information is labeled the same in the original MSA and county layers.

So, how should I proceed to merge this two layers and get the merged table of attributes with the attributes coming from both layers?

I am using QGIS 2.8.6-Wien on Ubuntu 16.04

  • Please add a tag indicating the software and version that you are using.
    – Tom
    Commented Oct 24, 2016 at 16:59

1 Answer 1


It sounds like you are one the right track. You can't have duplicate field names. What you can do is edit your shapefile by adding new columns and values (i.e. msa_geom and county_geom). Just open the shapefile, go to Properties > Attributes and add new columns. Use the field calculator to copy over data from another field. Then try the spatial join once you don't have name overlaps. Once joined, then export to csv.

In newer versions of QGIS (2.x), 'Attributes' is called 'Fields'

  • I did this (created the new fields and erased the original ones to avoid duplicates) but the problem remains. In particular, when choosing "Spatial Join" in MMQGIS, the attributes that I care about do not show up under the fields that will be merged.
    – flucoe
    Commented Oct 24, 2016 at 21:07
  • Sorry, press enter before I was done. So, I was digging a little bit more and realized that some of the attributes that I care about are in the County layer and were added from a CSV file using "Join". I don't know if this matters or no but going to Properties > Fields shows a different symbol on the left column for these added fields than for the original ones. I guess this is reflecting a difference that I'm not aware of, but that prevents these fields for being added in the Spatial Join.
    – flucoe
    Commented Oct 24, 2016 at 21:10
  • when you say "MMQGIS" do you mean michaelminn.com/linux/mmqgis I am not familiar with those plugins, but it looks like there is some documentation there.
    – Nikolai
    Commented Oct 24, 2016 at 21:23
  • Also just a hunch, but your "join" may have been a temporary join, hence being greyed out. You could try to export that layer as a new shapfile and then try a spatial join on the new file.
    – Nikolai
    Commented Oct 24, 2016 at 21:24
  • You were absolutely right. It was a temporary join, not permanent. It had nothing to do with MMQGIS. Once that was fixed, the spatial join worked. Thanks.
    – flucoe
    Commented Oct 24, 2016 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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