qgis/QGIS — pull request #1092 by vmora (2014-01-20 14:19:00+00:00)
Title: add svg export with layers

This allows to save svg in an inkscape compatible format with layers. Since the inkscape layers are top level svg groups, those groups can be axtracted in illustrator (script below).

Consecutive (z-order) graphic items that are not maps are grouped in the same layer, each map layers have its own group.

A checkbox has been added to the file selection dialog to enable this option, old export is still the default.

__ Adobe Illustrator script to extract layers from svg __

var idoc = app.activeDocument; // get active document
var ilayer = idoc.activeLayer; // get active layer

for (i=ilayer.groupItems.length-1; i>=0; i--){ // loop thru all groups backwards
var igroup = ilayer.groupItems[i]; // get group
var newLayer = idoc.layers.add(); // add new layer
newLayer.name = igroup.name; // rename layer same as group
igroup.move(newLayer,ElementPlacement.PLACEATEND); // move group to new layer
}