I have two shapefiles, a.shp and b.shp, containing point features with the following attribute tables:

id    att1   att2
1     1      1
2     2      2

id    att1   att2
3     1      1
4     2      1

If I use Vector->Geoprocessing Tools->Union to create a new shapefile ab.shp I end up having an attribute table like this:

id     att1    att2    id_2    att1_2   att2_2
1      1       1       null    null     null
2      2       2       null    null     null
null   null    null    3       1        1
null   null    null    4       2        1

But what I would like to have (and how it is in ArcGIS Desktop) is the following:

id   att1  att2
1    1     1
2    2     2
3    1     1
4    2     1

The fields are all of the same type (QString). So what would be the right way to produce the desired output?

  • What do you mean by 'how it is in arcgis'? You're looking for an Append type of function. There's a specific tool for that in ArcGIS, but depending on context Merge would get you a multi-point feature rather than separate point records. You don't want a Union, which is meant to combine attributes based on shared geometry. You could also start editing, copy the points from one shapefile, and paste them into the other. – Chris W Nov 27 '14 at 19:54

I would suggest using Vector/Data management Tools/Merge Shapefiles to One. I did a quick test using the data you supplied above, and also some of my own data, and both times it seemed to achieve what you wanted.

| improve this answer | |

Slightly off-topic, if you have gdal, you can also merge any number of shapefiles as follows on the command line:

ogr2ogr -update -append ab.shp a.shp  -f "esri shapefile" -nln ab
ogr2ogr -update -append ab.shp b.shp  -f "esri shapefile" -nln ab
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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