hangs when moving 2300 objects to new layer

Post questions on how to use or achieve an effect in Inkscape.
Posts: 6
Joined: Tue Oct 09, 2018 12:49 pm

hangs when moving 2300 objects to new layer

Postby hiccup » Wed Oct 10, 2018 5:25 am

i start by using inkscape to edit a .svg world map downloaded from wikipedia. it has ~2300 paths that outline the countries.

i want to manipulate these as a layer, so i select them (by dragging a rectangle -- why doesn't 'edit\select all' doesn't select anything?), right click, and 'move to layer' to a new layer i created. inkscape appears to hang with the 'move' button depressed. the UI is totally unresponsive. it doesn't crash, but spins the CPU at 100% indefinitely (>10 minutes) til i give up.

i don't see any relevant error in the terminal output.

this doesn't seem like a demanding request, doesn't it just have to update a layer pointer on a few thousand records? it's not some kind of intensive processing.

is this kind of problem common with inkscape? i'm new to it and vector graphics. is there a better way to approach this kind of problem? one confusion i have is why the contents of the original .svg i open doesn't appear as a layer -- why have an implicit "background" that holds objects but isn't a layer?

i'm on osx 10.13.6 and installed inkscape 0.92.2 2405546 using macports (x11, not xquartz).

Posts: 3099
Joined: Mon Oct 05, 2015 10:44 am

Re: hangs when moving 2300 objects to new layer

Postby Moini » Wed Oct 10, 2018 10:40 am


The SVG file format does not know what a 'layer' is, this is entirely an Inkscape-internal concept. A 'layer' in Inkscape is just a group in the SVG file. Because of this, you can have objects in the 'root' layer, which is the root of the SVG file. Inkscape only puts layer groups in it, but other programs put real objects into the root layer.

'Edit > Select all' only selects objects in the current layer. Switch to the root layer (dropdown in the status line at the bottom of the window), or use 'Select all in all layers'.

This operation takes some (a lot of) time, especially if:

- you have ever opened the objects dialog during the current Inkscape session
- you have lots of objects
- the layer you are moving the objects to has some different coordinate system

Try to move the objects in chunks.Also try if it's faster if you group them first.

If you want us to try out if it's faster on our systems (Linux, Windows), please share the file. Also, post your computer's specs for comparison.
Last edited by Moini on Wed Oct 10, 2018 10:22 pm, edited 1 time in total.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
Posts: 1161
Joined: Fri May 08, 2009 1:18 am
Location: UK

Re: hangs when moving 2300 objects to new layer

Postby Xav » Wed Oct 10, 2018 5:49 pm

As Moini said, SVG doesn't have layers so Inkscape's implementation of them is done by using groups that have special attributes to identify them as layers.

I don't know how Inkscape structures things internally, but in terms of the SVG file all 2,300 items have to be moved inside the <g> element. This is likely to entail updating a number of data structures that Inkscape keeps in memory to speed up day-to-day operations. Furthermore, SVG has no notion of a z-index at present - objects are rendered in the order they appear in the document, so higher layers/groups have to be moved to a later part of the document.

Depending on the structure of the document, if you're familiar with XML it might be quicker and easier to edit the SVG document in a text editor to "wrap" them in a <g> with suitable attributes. But that would only really work if they're mostly consecutive in the document and there aren't a lot of other elements getting in the way.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

User avatar
Posts: 10204
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA

Re: hangs when moving 2300 objects to new layer

Postby brynn » Thu Oct 11, 2018 6:11 am

Moini wrote:'Edit > Select all' only selects objects in the current layer.

It depends on what option you've chosen in Inkscape Preferences > Behavior > Selecting. If you choose "Select in all layers", then Select All does select in all layers.

hiccup wrote: why doesn't 'edit\select all' doesn't select anything?)

It might seem like it doesn't select anything, if you are zoomed in. If the bounding box is completely outside the screen area, you might not realize that something is selected. Using the status bar can help with this, because it will always tell you what is selected. If nothing is selected, it actually says "No objects selected".

It's not really surprising to me, that there's a delay with moving 2300 objects to a new layer, or that it takes 100% of the CPU -- especially if you're zoomed in, or especially if the file is already larger than those 2300 visible objects. Or especially if the Node tool is enabled. You could try grouping them all (at least temporarily). It might not take quite as long for them to move. But there may be several things you can do, to continue working in a file that is already large. Here's a little tutorial about avoiding performance issues.

https://forum.inkscapecommunity.com/ind ... article=35

Up until recently, I would have thought that if you downloaded the file from the internet, it's already been optimized as much as possible (made as lean and clean as possible). But apparently that's not always the case. There may be a lot of stuff in the file that's not really needed, that you could delete. Start by deselecting everything, then do File menu > Clean Up Document. Watch the status bar as you do that, and it will tell you how much stuff was removed. Maybe there's nothing there (maybe Wikimedia/Wikipedia is a better place to get SVG files?), but it can't hurt to try.

Return to “Help with using Inkscape”

Who is online

Users browsing this forum: No registered users and 5 guests