17

Is there any way to load a *.qml file to layer and set a style to it in Python (PyQGIS)?

Can I 'get into' this file in console?

I want to review it.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Jul 15, 2016 at 7:19
0

1 Answer 1

21

I have my qml styles in a fix path (c:/pyqgis_data/Styles/). So, to load arrows_red_orange.qml (exclusively for point layers), next lines at the Python Console of QGIS work:

>>>layer = iface.activeLayer()
>>>if layer.geometryType() == QGis.Point:
>>>...layer.loadNamedStyle('c:/pyqgis_data/Styles/arrows_red_orange.qml')
>>>layer.triggerRepaint()
answered Jul 15, 2016 at 8:35
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.