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).
thanks!
-erik
hangs when moving 2300 objects to new layer
Re: hangs when moving 2300 objects to new layer
Hi,
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.
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.
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)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: hangs when moving 2300 objects to new layer
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.
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.
Re: hangs when moving 2300 objects to new layer
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.
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design