I spend a ton of time talking about QGIS up here. I like QGIS. I like GIS in general and there are some days I wonder if I’m unintentionally ignoring the ESRI side of life. Actually I don’t for clients – 20+ years of Using ESRI software leaves me in a good spot to answer all sorts of questions.
So I went to visit a potential client this last week. It’s funny how a 20 minute visit can turn into a 3 hour discussion of GIS. Short story – we covered two pieces of software: ArcGIS, and QGIS. Shorter story – they are moving from ArcGIS to QGIS. It nice getting the view of someone casually using GIS (both packages) software who doesn’t do this day in and day out.
The conversation covered a lot of ground. One of things we talked about was lyr files. As a former instructor in the dark arts of ArcGIS, lyr files were one of those things everyone seemed to know something about and no one was entirely sure what to do with them. You see a lot of “Can I use LYR files in QGIS?” Well – no but here is a story on lyr and qlr files.
The short story on lyr files:
1. Symbolize your data layer in ArcGIS.
2. You can even set up a definition query to single out a particular feature in your layer. In this case I’ve singled out a tract of land a client works.
3. Right click your layer in the table of contents and save a lyr file.
Lyr files are super handy. You can symbolize data. You can label. You can set definition queries and save it all to a lyr file. ArcGIS treats an lyr like data (BUT IT’S NOT). You can add them by hitting the add data button so a lot of times people can and will get confused and think an lyr is data. So you will get emails from people going “Here I sent you some data” and it’s a bunch of lyr files. I generally make it a point to tell people to name them and make a different folder and keep them all there. Treat them as part of your project. Treat them as important. Don’t think they are data though.
BUT – What about QGIS?
1. Symbolize your data in QGIS
2. You can even set up a feature subset (definition query) to single out a particular feature in your layer. In this case I’ve singled out a tract of land a client works.
3. Right click your layer Layer Panel and save a layer definition file (a qlr).
Notice I tried to give this an identical three step description. You can’t add qlr files with an “add data” button in QGIS. You can drag and drop it onto your map canvas or use Layer -> Add from Layer Definition File to use it. No data is saved. This is just a pointer back to your data with symbology and other info saved.
- So can you use a lyr with QGIS? Nope.
- Can you use a qlr with ArcGIS? Nope.
- Can you define symbology in ArcGIS from a lyr file? Yes! Just import your symbology and choose your lyr and if the attribution matches you are good.
- Can you define symbology in QGIS from a qlr file? No – but that is what qml and sld files are for. Save those from your property menu and you can use those to symbolize other data.
- Can you open a lyr in a text editor and see how it works? NO…I think the greatest shortcoming of lyr is this.
- Can you open a qlr in a text editor and see how it works? YES…it’s an XML based file.
So as always make your life easier. Save lyr and qlr files with your data because you don’t want to spent tons of time symbolizing it over and over. Remember – neither qlr or lyr hold any data – just symbology and data queries. So don’t email your friends or consultants lyr or glr files.
— Craig Williams (@williamscraigm) April 13, 2015