1

I would like to merge 2 shapefiles to create just one:

1 - a shapefile for the 9 GOR English regions with 2 - a shapefile which has the rest of the UK: Scotland, Wales, Northern Ireland and England

The aim is to end up with a shapefile with 12 parts (9 GOR + Scotland + Wales + NI) so I can see difference on certain factors across the UK.

Does anyone know how to do this?

Just to be clear, I don't want to overlay them, I want them to sit side by side so I can see all the parts at once.

Alternatively if anyone has a .shp file for the 9 GOR English regions + Scotland + Wales (NI not necessary), that would also be great.

I have tried to follow these instructions: https://www.statsilk.com/maps/merge-multiple-map-layers-single-shapefile-using-quantum-gis#shapefile-preparation but the "Merge shapefiles to one" is not in my vector menu and I can't seem to be able to download the Merge Shape plugin due to "bad gateway".

UK with England broken down in 9 GOR

3
  • What software package are you using? I am guessing its QGIS by the link in the question? If it is, please update the tags in the question. When you say "side-by-side" are you referring to the attribute table? If so, are the attribute tables of your spatial datasets the same (ie. have the same field names?). Jul 9, 2018 at 1:03
  • Thanks Allan - Yes I am using QGIS so I have updated the tags. When I say "side-by-side", I mean, actually seeing all the polygons on the same map (i.e. Scotland and Wales as well as England's 9 GOR) rather than the attribute table. Once I get home tonight, I will do a quick example on QGIS and post the photo. Thanks for your help!
    – XavierFaux
    Jul 9, 2018 at 9:49
  • I have included an example from QGIS with the two shapefiles in my main post. I would like to merge them into 1.
    – XavierFaux
    Jul 9, 2018 at 17:57

2 Answers 2

7

For a simple task like this I would use ogr2ogr (it is in the OSGEO4W shell if you are on Windows).

To merge filename1.shp and filename2.shp into merge.shp you would do:

ogr2ogr -f ‘ESRI Shapefile’ merge.shp filename1.shp
ogr2ogr -f ‘ESRI Shapefile’ -update -append merge.shp filename2.shp -nln merge

Then just keep repeating the 2nd line for as many shapefiles as you want to merge.

3

There are several ways to merge vector layers in QGIS. While the ogr2ogr solution provided by Ian is perfectly viable, the need to use text commands can be a bit intimidating to the non-code oriented user (like me!). Here's another option.

The Processing Toolbox has two tools for merging vector layers. One is a core QGIS tool, the other is a SAGA tool.

  • The core QGIS tool provides the option to do a CRS transformation when merging the layers
  • The SAGA tool allows you to toggle two options: "Add source information" and "Merge fields by name"

Processing menu > Toolbox > type "merge" into the search bar in the Toolbox

enter image description here

Note: Different versions of QGIS have different tools available in the menus. Whenever you're trying to follow a tutorial and can't find a tool in the menu location mentioned, look for it in the Processing Toolbox.

Another Note: Layers should be in the same CRS before merging. (This is generally true for Geoprocessing tools.) To re-project a layer, right click on the layer name in the layers panel, choose Save as... and select the target CRS before saving as a new file.

The Merge Vector Layers tool can also be accessed through the Vector menu.

Vector menu > Data Management Tools > Merge Vector Layers...

enter image description here

Note: This answer was tested using QGIS 3.2.

2
  • Thanks - the 1st option worked. i had to get the CRS to match. I've now put the shapefile in Tableau so going to try and use it properly.Thanks!!
    – XavierFaux
    Jul 9, 2018 at 20:08
  • Thanks for the feedback. I'll update my answer to mention that input layers should have matching CRS.
    – csk
    Jul 9, 2018 at 20:46

Your Answer

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

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