{"id":294,"date":"2015-05-26T13:01:47","date_gmt":"2015-05-26T13:01:47","guid":{"rendered":"http:\/\/transnationalhistory.net\/mapping\/?page_id=294"},"modified":"2023-08-29T15:13:38","modified_gmt":"2023-08-29T15:13:38","slug":"advanced","status":"publish","type":"page","link":"https:\/\/transnationalhistory.net\/mapping\/tutorials\/shapefiles\/advanced\/","title":{"rendered":"One Step Further: Merging Shapefiles with Union"},"content":{"rendered":"<p>In some situations you may want to merge two shapefiles together.<\/p>\n<p>For instance, I am working on Franco-Swiss railway connections. Each national railway network is in a different shapefile. Both layers coincide perfectly and I would like them to be merged into one common &#8220;Franco-Swiss Railways&#8221; shapefile.<\/p>\n<p><a href=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-fr-ch-railways1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-336 size-full\" src=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-fr-ch-railways1.jpg\" alt=\"\" width=\"462\" height=\"366\" srcset=\"https:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-fr-ch-railways1.jpg 462w, https:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-fr-ch-railways1-300x238.jpg 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>The border can hardly be seen as both shapefiles coincide very well<\/em><\/p>\n<p style=\"text-align: left;\">In order to merge them, click on\u00a0<strong>Vector<\/strong> &gt;\u00a0<strong>Geoprocessing Tools<\/strong> &gt;\u00a0<strong>Union<\/strong>.<\/p>\n<p style=\"text-align: left;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-302\" src=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union.jpg\" alt=\"3 union\" width=\"359\" height=\"328\" srcset=\"https:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union.jpg 359w, https:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union-300x274.jpg 300w\" sizes=\"auto, (max-width: 359px) 100vw, 359px\" \/><\/p>\n<p style=\"text-align: left;\">In the window that just opened, you need to choose which layer will be inserted into the other one. In our case, this does not really matter as the two layers only meet at the border. This will be more important if you have, for instance, a map of Africa to which you are adding some elements located in Western Africa (<a href=\"https:\/\/www.youtube.com\/watch?v=EkGrAbi2rSE\" target=\"_blank\" rel=\"noopener\">see example video on YouTube<\/a>).<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union-box.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-303\" src=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union-box.jpg\" alt=\"3 union-box\" width=\"397\" height=\"276\" srcset=\"https:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union-box.jpg 397w, https:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-union-box-300x209.jpg 300w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/a><\/p>\n<p style=\"text-align: left;\">Once you have clicked <strong>OK<\/strong>, the new layer is created. Untick the two original shapefiles and see if the result is satisfactory.<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-layers-after-union.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-337\" src=\"http:\/\/transnationalhistory.net\/mapping\/wp-content\/uploads\/2015\/05\/3-layers-after-union.jpg\" alt=\"3 layers after union\" width=\"163\" height=\"49\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Last update: 26 May 2015 with QGIS 2.8.1 Wien.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/transnationalhistory.net\/mapping\/tutorials\/shapefiles\/\">Back to Tutorial 3: Finding, Importing and Editing Shapefiles<\/a>\u00a0| <a href=\"http:\/\/transnationalhistory.net\/mapping\/tutorials\/georeferencing\/\">Next tutorial: Georeferencing Maps<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In some situations you may want to merge two shapefiles together. For instance, I am working on Franco-Swiss railway connections. Each national railway network is in a different shapefile. Both layers coincide perfectly and I would like them to be merged into one common &#8220;Franco-Swiss Railways&#8221; shapefile. The border can hardly be seen as both [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":70,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-294","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/pages\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/comments?post=294"}],"version-history":[{"count":2,"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/pages\/294\/revisions"}],"predecessor-version":[{"id":594,"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/pages\/294\/revisions\/594"}],"up":[{"embeddable":true,"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/pages\/70"}],"wp:attachment":[{"href":"https:\/\/transnationalhistory.net\/mapping\/wp-json\/wp\/v2\/media?parent=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}