I work with a polyline layer:
screenshot
and the layer located in "G:\desktop\qgis\lyr".
After i save the layer in qlr file and saved it in "G:\desktop\qgis\lyr", i try to load the qlr file with "add from layer definition file" function,to a map that located in "G:\desktop\Project".
The result is that the qlr file doesn't appear on the map and there no properties for that layer. There no symbology either.
table of content
-
Does it work if you add it to a new project?Joseph– Joseph2016年06月15日 08:49:17 +00:00Commented Jun 15, 2016 at 8:49
-
it doesn't work even in a new projectnewGIS– newGIS2016年06月15日 09:23:01 +00:00Commented Jun 15, 2016 at 9:23
-
Which QGIS version are you using?Joseph– Joseph2016年06月16日 09:19:12 +00:00Commented Jun 16, 2016 at 9:19
-
version QGIS 2.12newGIS– newGIS2016年06月19日 05:23:23 +00:00Commented Jun 19, 2016 at 5:23
1 Answer 1
I've had the same issue. I looked in the .qlr file and saw that the link in the .qlr file to the underlying data file (in my case a .shp file) was relative...meaning the xml in the .qlr file looked like this:
<datasource>./Contour Lines.shp</datasource>
Suspecting the issue might be the .qlr file linking to the actual data, I played around a bit. I found two solutions, and both were path based:
1) Change this to an absolute path and upon reloading the .qlr file all will be well.
2) Move the .qlr file and the underlying data into the same directory where the project file is saved.
It seems the relative path reference is tied to the proejct file location and not the .qlr file location.
Did you find another solution? I hope this helps. There could easily be more going on here than I understand, but it is a workaround.
-
-
1I tried your solution and the replacement of the relative by the absolute path solves the QLR problem efficiently. Thanks Bryan :) @newGIS : it's in the QLR file. just open it with for example Notepad ++ or any text pad you have.gisnside– gisnside2016年09月16日 13:08:05 +00:00Commented Sep 16, 2016 at 13:08
-
How do you replace the relative path with an absolute path?T.O.6– T.O.62017年05月08日 08:36:36 +00:00Commented May 8, 2017 at 8:36