3

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

gisnside
7,9082 gold badges33 silver badges75 bronze badges
asked Jun 15, 2016 at 6:34
4
  • Does it work if you add it to a new project? Commented Jun 15, 2016 at 8:49
  • it doesn't work even in a new project Commented Jun 15, 2016 at 9:23
  • Which QGIS version are you using? Commented Jun 16, 2016 at 9:19
  • version QGIS 2.12 Commented Jun 19, 2016 at 5:23

1 Answer 1

5

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.

answered Jul 23, 2016 at 23:48
3
  • where i find that line? Commented Jul 27, 2016 at 11:45
  • 1
    I 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. Commented Sep 16, 2016 at 13:08
  • How do you replace the relative path with an absolute path? Commented May 8, 2017 at 8:36

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.