I made a style which needs function to work. In my particular case it is calculating azimuth between nodes of rectangles to display "direction".

enter image description here enter image description here

The problem is, if I save the style, the function is not saved with it. So if somebody else wants to look at it on other computer, the function is missing and style doesn't work as expected. Is there some way to include function or workaround to not need to use function to achieve saving the style including the calculation of direction?

Poor workaround like create new column which will be populated with this function is not an option here because the key is interactive response of style on change / addition of rectangle.

  • IMHO it's can be considered a bug... anything related with a symobol o a rendere would be saved in QML... may you file a qgis issue? May 16 '16 at 8:56
  • Not sure. I didn't add support for that because of the complications it adds.
    – Nathan W
    May 16 '16 at 9:16

The expression functions are all stored under .qgis2\python\expressions You can copy and install them onto any machine that needs them. The other option is to add them as a Python macro for the project under Project -> Properties -> Marcos. Paste the text of your expression function in the there.

enter image description here

  • 1
    Thank you, macro seems to be good option for me. I am going to test it tomorrow. You mentioned that adding function into style would add complications but also it causes complications without it :)
    – Miro
    May 16 '16 at 10:45
  • 2
    The life of a developer ;)
    – Nathan W
    May 16 '16 at 11:28
  • 1
    Macro doesn't work in this case, when I open the project on other computer it asks for allowing macros but because the layer style is already loaded without the function, enabling macros doesn't do anything with it.
    – Miro
    May 16 '16 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.