I have one shapefile which contains hiking routes and another shapefile which has ski routes. Sometimes they follow the exact same path.

In QGIS if the lines mentioned above are in the same SHP I can merge two lines in edit mode by selecting them and Merge selected features and then chose Concatenation with an attribute field so that the value of the merged line will be "hiking,skiing" etc.

This method takes time since I have thousands of lines like this.

Is there a way to do this for whole shape files? Maybe five or six of them.

I saw How can i merge lines with same name and intersect each other? which is similar but I'm not familiar with spatialite and would like to stick to GDAL and/or QGIS.

  • 1
    Are they exactly identical? A spatial join with an 'are identical' operator would work if available, at least to get you the ones that do need to be combined. Similarly Intersecting the two shapefiles should produce a result that is only the lines they have in common. Those lines could be removed from the original dataset and then the intersect results and modified originals all merged/joined together. – Chris W Apr 28 '15 at 21:32
  • Yes exactly identical! Or The overlap at some parts and have their nodes on the exact same place when they intersect. I did intersect between two but when I have 6 of them it takes time to intersect them all and then intersect some etc. Or did I miss out something? – oskarlin Apr 29 '15 at 7:38
  • If only portions of lines overlap, the problem is more complex. Intersect is still the way to go, and will give you the overlapping portions. The problem is pulling only those sections out of the source datasets. ArcGIS can do multiple layers at once, but I don't know if anything QGIS can. And it might not help because you have to intersect each file with every other file to get any overlaps and not just what is common to all of the files (ie hiking and skiing but not biking doesn't show if you do all three at once). Maybe merge/append all lines to one file and intersect that with itself? – Chris W Apr 29 '15 at 18:16

Your Answer

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

Browse other questions tagged or ask your own question.