SVG IDs don't match layer names

Bug #243383 reported by Bastien Nocera
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Wishlist
Unassigned

Bug Description

When exporting to SVG, or saving to Inkscape SVG, the IDs of the different layers bears no resemblance to the layer names saved.

This makes it hard to modify SVGs that will then be processed programatically, as one needs to change the IDs by hand after editing the file.

Tags: layers
Revision history for this message
Erich E. Hoover (ehoover) wrote :

I would also like to be able to programatically pick out layers from a document by ID. While the "inkscape:label" tag gets saved with the name when saving to Inkscape SVG it seems that the layer name (or a calculable similar name) should also be stored to the "id" tag for plain SVG documents.

Revision history for this message
Jon A. Cruz (jon-joncruz) wrote :

No. "id" elements must be unique in the entire document, etc., whereas layer names should be duplicable. Making the id more visible might help.

jazzynico (jazzynico)
tags: added: layers
Revision history for this message
Rena Kunisaki (i-am-inuyasha) wrote :

I was about to report the same thing. If layer names aren't required to be unique (which I agree with), then set them as the object's name rather than ID. I noticed this with optimized SVG, but it's an issue with plain as well.

Revision history for this message
nightrow (jb-benoit) wrote :

I confirm the behavior.
When saving as plain svg, layer names (choosed by user) are removed to keep only layer ID, with no link to layer name.
Having a link between layer name and layer ID would help with later layer name handling.

Changed in inkscape:
status: New → Confirmed
importance: Undecided → Low
importance: Low → Wishlist
Revision history for this message
Michael Sheasby (msheasby) wrote :

Hit this today. Same logic - programmatic editing of the output SVGs is difficult if layers aren't saved with IDs - please let us edit layer IDs, or copy the layer display names to the output layer IDin the output optimized SVG

Revision history for this message
Michael Sheasby (msheasby) wrote :

sorry, I should have noted: there is a workaround.

The layer ID is exposed in the saved 'native' SVG:

  <g
     inkscape:groupmode="layer"
     id="layer2" <<<< not editable from UI
     inkscape:label="Guides" <<<< chosen in UI
     style="display:inline"
     sodipodi:insensitive="true">

if you edit the ID manually in the SVG file,

  <g
     inkscape:groupmode="layer"
     id="Guides" <<<< manually edited in SVG
     inkscape:label="Guides"
     style="display:inline"
     sodipodi:insensitive="true">

... then inkscape will load / edit / resave the document without changing it.
So it seems programmatic editing of the output SVG becomes possible.

Perhaps this will help others.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.