{"id":2176,"date":"2018-09-07T10:49:21","date_gmt":"2018-09-06T22:49:21","guid":{"rendered":"http:\/\/blogs.lincoln.ac.nz\/gis\/?p=2176"},"modified":"2023-05-07T03:29:36","modified_gmt":"2023-05-07T03:29:36","slug":"save-your-marriage-use-layer-files","status":"publish","type":"post","link":"https:\/\/blogs.lincoln.ac.nz\/gis\/save-your-marriage-use-layer-files\/","title":{"rendered":"Save your marriage &#8211; use layer files"},"content":{"rendered":"<p><em>Layer files are a useful way to recreate legends and get consistent symbology.\u00a0 This post outlines what they are and how to use them.\u00a0 <\/em><\/p>\n<p>Geology&#8230;who doesn&#8217;t love geology?\u00a0 And who doesn&#8217;t love geology maps especially?\u00a0 (<em>Ed. &#8211; Only heathens&#8230;<\/em>)\u00a0 The image below shows one of the\u00a0 1:250,000 scale geology maps that cover the country, produced by <a href=\"https:\/\/www.gns.cri.nz\/\" target=\"_blank\" rel=\"noopener noreferrer\">Geological and Nuclear Sciences<\/a> (GNS).\u00a0 They are rich in detail and symbology and anyone who uses them frequently will be familiar with the shadings, and colours and patterns that describe our geology underfoot.\u00a0 Here&#8217;s an image of the whole map but we&#8217;ll only focus on a few aspects:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/qmapCHC.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2185\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/qmapCHC.jpg\" alt=\"\" width=\"875\" height=\"622\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/qmapCHC.jpg 875w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/qmapCHC-300x213.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/qmapCHC-768x546.jpg 768w\" sizes=\"auto, (max-width: 875px) 100vw, 875px\" \/><\/a><\/p>\n<p>Here&#8217;s an image zoomed in on the Christchurch\/Banks Peninsula area:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/CHC.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2186\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/CHC.jpg\" alt=\"\" width=\"489\" height=\"451\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/CHC.jpg 489w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/CHC-300x277.jpg 300w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/a><\/p>\n<p>And here&#8217;s a portion of the legend &#8211; it&#8217;s quite an extensive, custom legend and I can only show a small part to give you the sense of detail but I hope you get the picture:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Legend.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2187\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Legend.jpg\" alt=\"\" width=\"1142\" height=\"431\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Legend.jpg 1142w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Legend-300x113.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Legend-1024x386.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Legend-768x290.jpg 768w\" sizes=\"auto, (max-width: 1142px) 100vw, 1142px\" \/><\/a><\/p>\n<p>If I&#8217;d like to recreate the look and feel of these data on my own map, I&#8217;ll first need the same data.\u00a0 Happily, we have copies of all the data layers that make up these maps &#8211; you can find them in J:\\Data\\QMAP-250K.\u00a0 The main layer of interest is probably the &#8220;NZL_GNS_250K_geological_units&#8221; feature class, which I&#8217;ll show you on the map below (using<a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/a-new-window-on-the-world-arcgis-pro\/\"> ArcGIS Pro<\/a>):<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/QMAPSingleSymbol.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2178\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/QMAPSingleSymbol.jpg\" alt=\"\" width=\"1361\" height=\"576\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/QMAPSingleSymbol.jpg 1361w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/QMAPSingleSymbol-300x127.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/QMAPSingleSymbol-1024x433.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/QMAPSingleSymbol-768x325.jpg 768w\" sizes=\"auto, (max-width: 1361px) 100vw, 1361px\" \/><\/a><\/p>\n<p>By default, any new layer added is shown as a single symbol for all features, so there&#8217;s not much to differentiate one unit from another.\u00a0 Amongst the many attributes is one called &#8220;plotName&#8221; which is what is usually shown on the maps.\u00a0 So I&#8217;ll change the symbology to Unique Values and let it assign a colour to each unit and zoom in, as shown below:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/InPro.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2188\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/InPro.jpg\" alt=\"\" width=\"1061\" height=\"576\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/InPro.jpg 1061w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/InPro-300x163.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/InPro-1024x556.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/InPro-768x417.jpg 768w\" sizes=\"auto, (max-width: 1061px) 100vw, 1061px\" \/><\/a><\/p>\n<p>Hmmmm&#8230;the same data, yes, but how do I get it to look like the standard geology map from GNS?\u00a0 I&#8217;ve got two options.\u00a0 I could go through each symbol, unit by unit and try to match each as best I can.\u00a0 This is painstaking business and fraught with frustration.\u00a0 LOTS of frustration.\u00a0 Something like this could end a marriage.\u00a0 Or make someone quit and join an ashram in southern India.\u00a0 Option two is a lot more feasible.<\/p>\n<p><strong>Layer Files<\/strong><\/p>\n<p>The good people at GNS went to great lengths to symbolise their maps.\u00a0 So much so that they have made that symbology transportable in the from of<a href=\"https:\/\/gis.stackexchange.com\/questions\/54111\/what-is-layer-file-lyr-in-arcgis-desktop\" target=\"_blank\" rel=\"noopener noreferrer\"> layer files<\/a>.\u00a0 We&#8217;ve talked about these <a href=\"http:\/\/blogs.lincoln.ac.nz\/gis\/getting-consistent-symbology-with-layer-files\/\" target=\"_blank\" rel=\"noopener noreferrer\">once before<\/a> in a different context.\u00a0 Layer files are sort of front ends\u00a0on data layers that have captured the symbology choices.\u00a0 If you look in the QMAP-250K &gt; Support &gt; Layerfiles folder you&#8217;ll see there\u00a0is another folder called\u00a0NZL_GNS_250K_geology (2nd edition).\u00a0 Inside <em>that<\/em> (have you left a trail of breadcrumbs?) is a collection of files, all ending in .lyr and with names that match the feature class layer names.<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Layerfiles.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2179\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Layerfiles.jpg\" alt=\"\" width=\"959\" height=\"498\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Layerfiles.jpg 959w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Layerfiles-300x156.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/Layerfiles-768x399.jpg 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><\/a><\/p>\n<p>These layer files will make it a lot easier to get our symbology to match GNS&#8217;s &#8211; because it\u00a0tells Pro (or ArcMap) how to render the data.\u00a0 Note the file sizes &#8211; these layers contain no spatial data.\u00a0 Think of them as the saved legend for each of the layers shown on the GNS map.\u00a0 Happily we can import these layer files and use them for our symbology.\u00a0 Here&#8217;s how:<\/p>\n<ul>\n<li>Back in the Symbology tab, click on the three horizontal bars and choose &#8220;import symbology&#8221;<\/li>\n<\/ul>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/ImportSymbology.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2180\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/ImportSymbology.jpg\" alt=\"\" width=\"299\" height=\"145\" \/><\/a><\/p>\n<ul>\n<li>Like most things in Pro, this opens a tool that needs to be run.\u00a0 Set the &#8220;Symbology Layer&#8221;\u00a0to the layer file in the Support folder and note that it&#8217;s already matched an attribute in the layer file with a similar attribute in the feature class:<\/li>\n<\/ul>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/ImportSymTool.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2181\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/ImportSymTool.jpg\" alt=\"\" width=\"296\" height=\"331\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/ImportSymTool.jpg 296w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/ImportSymTool-268x300.jpg 268w\" sizes=\"auto, (max-width: 296px) 100vw, 296px\" \/><\/a><\/p>\n<p><em>(Note that you could use any other symbolised feature class or shapefile as the &#8220;Symbology Layer&#8221;, not just layer files, i.e. if you&#8217;ve already symbolised another layer on your map you can\u00a0import that same symbology so that legends match.)<\/em><\/p>\n<p>When I run this tool, here&#8217;s the result (with a bit of transparency):<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/WithLayerFile.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2189\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/WithLayerFile.jpg\" alt=\"\" width=\"1065\" height=\"579\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/WithLayerFile.jpg 1065w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/WithLayerFile-300x163.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/WithLayerFile-1024x557.jpg 1024w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/WithLayerFile-768x418.jpg 768w\" sizes=\"auto, (max-width: 1065px) 100vw, 1065px\" \/><\/a><\/p>\n<p>In ArcMap it&#8217;s a little more straightforward &#8211; from the Symbology tab, click the Import button at upper right and point to the layer file.\u00a0 You&#8217;ll be presented with an extra box or two to ensure you line up the right attributes.\u00a0To fully finish off the map to make it match the GNS map more completely, we would need to do some more work &#8211; adding pertinent layers and importing their layer files.<\/p>\n<p>By using layer files I can save myself huge amounts of time and can be\u00a0quite sure I&#8217;ve got the symbology right &#8211; that&#8217;s their real value.<\/p>\n<p>But it&#8217;s not all fun and games.\u00a0 One limitation of layer files is that they don&#8217;t adapt to clipped out features.\u00a0 In other words, if I&#8217;ve clipped out, say Banks Peninsula\u00a0from the national scale layer and then imported the layer file, I&#8217;d end up with <strong>all<\/strong> the geological unit names, not just the ones in Banks Peninsula.\u00a0 Maybe there&#8217;s a way around this but I haven&#8217;t found it yet.\u00a0 (Anyone out there cracked this?)<\/p>\n<p>Another useful way to use layer files is as a way to preserve all your hard work on making legends.\u00a0 The Pro project document (or the ArcMap map document) saves the legend symbology but it you wanted to use the same legends in another map, or if you share your feature class\/shapefile with someone else and you want them to have use the same symbology, go to the Share tab and click &#8220;Layer File&#8221; in the Save as group:<\/p>\n<p><a href=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/SaveLayerFilePro.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2182\" src=\"https:\/\/d-blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/SaveLayerFilePro.jpg\" alt=\"\" width=\"842\" height=\"124\" srcset=\"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/SaveLayerFilePro.jpg 842w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/SaveLayerFilePro-300x44.jpg 300w, https:\/\/blogs.lincoln.ac.nz\/gis\/wp-content\/uploads\/sites\/3\/2018\/09\/SaveLayerFilePro-768x113.jpg 768w\" sizes=\"auto, (max-width: 842px) 100vw, 842px\" \/><\/a><\/p>\n<p>(in ArcMap, right-click on the layer name in the Table of Contents and choose &#8220;Save as Layer File&#8221;)<\/p>\n<p>Now, you or anyone else that has the layer and the layer file, can have the same symbology on two different maps.<\/p>\n<p>Not all layers will have layer files, but when they do, they&#8217;re a useful way of ensuring consistent symbology.\u00a0 And appearances can be everything.<\/p>\n<p>C<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Layer files are a useful way to recreate legends and get consistent symbology.\u00a0 This post outlines what they are and how to use them.\u00a0 Geology&#8230;who doesn&#8217;t love geology?\u00a0 And who doesn&#8217;t love geology maps especially?\u00a0 (Ed. &#8211; Only heathens&#8230;)\u00a0 The image below shows one of the\u00a0 1:250,000 scale geology maps that cover the country, produced [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2176","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/comments?post=2176"}],"version-history":[{"count":1,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2176\/revisions"}],"predecessor-version":[{"id":4116,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/posts\/2176\/revisions\/4116"}],"wp:attachment":[{"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/media?parent=2176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/categories?post=2176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.lincoln.ac.nz\/gis\/wp-json\/wp\/v2\/tags?post=2176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}