Merging drawings

A workaround

This tutorial does not concern a great feature, but rather a necessary workaround. If you have already been using Inkscape, you could already have noticed that it is rather difficult to merge two layered files together. If you use File / Import, all the layer structure from the imported file is simply gone.

The problem

Let's assume we have different parts of one cave drawn in two different files. They have identical layer structure, with gallery outline, details and centerline neatly placed on three separate layers.

The plan is to merge the two files by layers, so that each of the three layers of the final file contains relevant objects from both files.

Use these files to follow the tutorial: cave1, cave2.


Open the first file. Select Extensions / Speleo / Layer tricks / Pack for export. Tell the extension to Pack: All layers. Click Apply.

Your layers are now gone and you should have just one large object containing all of them in your drawing.

Make sure you are in the root layer, by double clicking on some empty area on your drawing until the bottom status bar indicates (root).

Select the sole object (Ctrl+A) and copy it to clipboard (Ctrl+C).


Go to the second file and open the layers dialog (Layer / Layers ...). Create a new empty layer, say Import. Paste your other file contents into that layer (Ctrl+V).

Now, with the packed object selected, go to Extensions / Speleo / Layer tricks / Unpack group. Notice the Import layer now has our three sub-layers.

Note: if you are missing some symbols in the pasted drawing, try Extensions / Speleo / Symbols / Repair file.


It would be nice to have the two parts of this cave in proper alignment. Fortunately, we imported centerline into both of the drawings.

Select the top-level Survey layer. Go to Extensions / Speleo / Morph to new centerline. Select Quick shift as the morphing method, untick all checkboxes and click Apply. The pasted drawing should now move into proper position!

Merging layers

Now, with the top-level Survey layer still selected, choose Extensions / Speleo / Layer tricks / Merge layers by name.


We are done merging the files. And everything sits in its proper layer! Note that the Import layer is empty again. You can safely delete it.