Saturday, 5 May 2018

Using relative path in QGIS 3.0 Processing Modeler?


Using QGIS 3.0, we are working on creating a tool that will allow people to check that their snapping is correct with several linear features stacked on each other. A co-worker of mine figured out how to do it. However, when you first set it up, you have to open the graphical modeler and set the style manually. What she currently has is a path to her own desktop to the folder that has all the possible styles. I am trying to find a way to make it universally, find the CURRENT users profile, THEN search for the file path.


Currently the path is set to something like this:


C:/Users/jwagner/Desktop/Staging Folder/Layer Styles/CableVertex_Incorrect.qml

I tried editing it to use something like this:


Environ("USERPROFILE") & "\Desktop\V1.2\Layer Styles\CableVertex_Incorrect.qml"


We have also tried using "%," and "~" to no avail. The end goal is to have this path already set when we give people the model file. That way we aren't having to personally show every single person on our project how to set styles. I know from personal experience that it will lead to problems later on down the line when trusting everyone else to remember how to properly do it on their own.



Answer



If you use different computer on a network it could be easier to copy your QML on a shared location that all user can access. this way you could hard code the path and if you have to made change to your QML you dont have to update all the copy on every computer.


If that not an option I guess you could copy the QML in a location accessible for all user like C:/CableVertex_Incorrect.qml ...


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...