Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a vector layer in QGIS and using Python I would like to be able to export the layer styling to a string variable and import styling in a string variable to the layer again (pseudo code):

style_string = layer_1.rendererV2().export_style()
layer_2.rendererV2().import_style(style_string))

I have found the two methods writeSld(...) and loadSld(...) in the QgsFeatureRendererV2 but I cannot find any examples of how to use them together.

The only clue I have found was this blog post which describes how writeSld(...) can be used. But when I try to import the XML document back into the renderer using loadSld(...) QGIS gives me a minidump.

Question:
Can anyone give me an example of how this can be done?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.