{"id":727,"date":"2022-02-16T22:35:06","date_gmt":"2022-02-17T03:35:06","guid":{"rendered":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/?post_type=chapter&#038;p=727"},"modified":"2022-02-18T22:16:10","modified_gmt":"2022-02-19T03:16:10","slug":"part-ii-c-reusing-layer-styles","status":"publish","type":"chapter","link":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/chapter\/part-ii-c-reusing-layer-styles\/","title":{"raw":"Part II C: Reusing Layer Styles","rendered":"Part II C: Reusing Layer Styles"},"content":{"raw":"After we have customized our layer\u2019s symbology and labels, there are a few ways in which we can reuse this styling. Reusing styles is useful for a couple of reasons. First, when we add a shapefile to QGIS, it will not show any symbology; we have to spend time designing its symbology. So, reusing our symbology allows us to quickly symbolize a newly added layer without having to spend time in the layer\u2019s Properties menu. Second, a key point of cartography is honesty in presentation of map data. Cartographers strive to present their map data as honestly and accurately as possible. By reusing styles across a series of maps, a cartographer can provide the necessary consistency for telling an honest story with his or her maps.\r\n\r\nFor example, let\u2019s say that we not only had a shapefile containing forestry data for PEI for 1935 but also shapefiles containing forestry data for PEI in 1955, 1975, and 1995. Provided that the shapefiles were all polygons and all had exactly the same headers in their attribute tables, we could apply the same Graduated symbology style we created for the 1935 layer to the others. All of the layers would thus have the same class breaks and colour scheme, making for easy and accurate comparisons across each of the time points. As a bonus, we could also copy our labels to the other layers.\r\n<h1>Copying a Style<\/h1>\r\nSince we do not have the hypothetical forestry layers mentioned above, let\u2019s say that you would like to copy the styling that we created for the 1935 inventory region layer in this chapter\u2019s project file to the same layer in Chapter 1\u2019s project file. To quickly do so:\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Make sure that both projects are open. That is, make sure that you have two different windows of QGIS open, one with Chapter 1\u2019s project file and one with Chapter 2\u2019s project file.\r\n<ul>\r\n \t<li style=\"font-weight: 400\">On Windows, one good way to open two instances of QGIS is to have one QGIS window open, right-click the QGIS button in the Taskbar, and then click QGIS Desktop. A second instance of QGIS will open, and you can click Project and then Open to open another project, such as Project1.<\/li>\r\n \t<li style=\"font-weight: 400\">On a Mac, it is more difficult to have two projects open at once. However, you can still copy a layer and then open a different project (note that this will close your other project) and paste that layer into the Layers panel.<\/li>\r\n<\/ul>\r\n<\/li>\r\n<\/ul>\r\n[caption id=\"attachment_836\" align=\"aligncenter\" width=\"328\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image053.png\" alt=\"Figure 2.109. QGIS Desktop options.\" width=\"328\" height=\"178\" class=\"size-full wp-image-836\" \/> <strong>Figure 2.109<\/strong>[\/caption]\r\n<ul>\r\n \t<li style=\"font-weight: 400\">In the QGIS window containing the project that features the layer whose style you would like to copy, right-click this layer and click Styles, and then Copy Styles, and then All Style Categories.<\/li>\r\n<\/ul>\r\n[caption id=\"attachment_837\" align=\"aligncenter\" width=\"883\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055.png\" alt=\"Figure 2.110. QGIS window containing the project that features the layer whose style you would like to copy, right-click this layer and click Styles, and then Copy Styles, and then All Style Categories.\" width=\"883\" height=\"676\" class=\"size-full wp-image-837\" \/> <strong>Figure 2.110<\/strong>[\/caption]\r\n<ul>\r\n \t<li style=\"font-weight: 400\">In the QGIS window containing the project that features the layer onto which you would like to copy the style, right-click this layer and click Styles, and then Paste Style, and then All Style Categories.<\/li>\r\n<\/ul>\r\n[caption id=\"attachment_838\" align=\"aligncenter\" width=\"1539\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057.png\" alt=\"Figure 2.111. This image shows the QGIS window with the 1935 inventory layer selected, with a pop-up where the second last option (Styles) is highlighted. From this first pop-up stems a second pop-up where the second option (Paste Style) is highlighted. The final pop-up that stems from the second has the first option (All Style Categories) selected.\" width=\"1539\" height=\"923\" class=\"size-full wp-image-838\" \/> <strong>Figure 2.111<\/strong>[\/caption]\r\n\r\nHere is the result of the paste:\r\n\r\n[caption id=\"attachment_839\" align=\"aligncenter\" width=\"1101\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059.png\" alt=\"Figure 2.112. Updated map with the pasted layer results.\" width=\"1101\" height=\"590\" class=\"size-full wp-image-839\" \/> <strong>Figure 2.112<\/strong>[\/caption]\r\n\r\n<div class=\"textbox shaded\"><strong>Note<\/strong>: when you copy and paste styles between layers in QGIS, it does not copy your filter settings.<\/div>\r\n&nbsp;\r\n<div class=\"textbox shaded\"><strong>Note<\/strong>: you can only copy and paste styles between layers in QGIS. It will not work between QGIS and another GIS application, such as ArcGIS Pro.<\/div>\r\n&nbsp;\r\n<div class=\"textbox shaded\"><strong>Note:<\/strong> if you copy a style, please note that you must apply the style to the same layer (perhaps in a different project file) or to a layer that has the same structure. A different layer of the same structure would be one that is of the same geometry type (i.e., points, lines, or polygons) and that has the same attribute that was originally used for symbolization.<\/div>\r\n<h1>Saving a Style<\/h1>\r\nThe process outlined above for copying a style is effective for times when you only need to copy a style once and quickly paste it onto another layer. However, if you wish to save your style permanently, you have a few options.\r\n<h2>Saving a QGIS Style File (.qml)<\/h2>\r\nA QGIS Style File (.qml) offers much of the same functionality as the process of copying and pasting symbology, but it allows you to permanently save this symbology instead of temporarily storing it on your clipboard. It also allows you to have a layer\u2019s symbology load automatically when the layer is added to a project.\r\n\r\nTo save a QGIS Style File:\r\n<ul>\r\n \t<li>In the table of contents, right-click the layer whose style you would like to save.<\/li>\r\n \t<li>Click Properties\u2026<\/li>\r\n \t<li>Click Information.<\/li>\r\n \t<li>At the bottom of the Information window, click Style and then Save Style\u2026<\/li>\r\n<\/ul>\r\n[caption id=\"attachment_840\" align=\"aligncenter\" width=\"835\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061.png\" alt=\"Figure 2.113. At the bottom of the Information window, Style is selected and a pop-up appears in which Save Style is selected.\" width=\"835\" height=\"805\" class=\"size-full wp-image-840\" \/> <strong>Figure 2.113<\/strong>[\/caption]\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Click Browse<\/li>\r\n<\/ul>\r\n[caption id=\"attachment_841\" align=\"aligncenter\" width=\"535\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063.png\" alt=\"Figure 2.114. This shows the Save Layer Style page. Under the save file information is the option to browse.\" width=\"535\" height=\"576\" class=\"size-full wp-image-841\" \/> <strong>Figure 2.114<\/strong>[\/caption]\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Navigate to the folder in which the layer from which we are saving the style (i.e., the original layer) is stored. In this case, navigate to the folder called Project1\\Data\\forest_35.SHP.\r\n<ul>\r\n \t<li style=\"font-weight: 400\">If you need a reminder as to its location, check the \u201cPath\u201d field in the Information window.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li style=\"font-weight: 400\">Next to File name, type in the name of the shapefile associated with this style file. We want the original shapefile and the QGIS Style File to have the same name.\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Although the two files will have the same name, their extensions will differ. The shapefile will be called 1935 inventory_region.shp while its corresponding QGIS Style File will have the name 1935 inventory_region.qml.<\/li>\r\n<\/ul>\r\n<\/li>\r\n \t<li style=\"font-weight: 400\">Click Save<\/li>\r\n<\/ul>\r\nIf you open a new project and add the 1935 inventory_region shapefile from the forest_35.SHP folder, it will be automatically symbolized according to the settings stored in the QGIS Style File that we just saved. This is done automatically because the shapefile and QGIS Style Files were stored in the same folder and were given the same name.\r\n\r\nHere, we added the shapefile from the forest_35.SHP folder, and QGIS automatically loaded the corresponding QGIS Style File.\r\n\r\n[caption id=\"attachment_842\" align=\"aligncenter\" width=\"1095\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065.png\" alt=\"Figure 2.115. This is an updated map with the shapefile from the forest_35.SHP folder.\" width=\"1095\" height=\"590\" class=\"size-full wp-image-842\" \/> <strong>Figure 2.115<\/strong>[\/caption]\r\n\r\n<div class=\"textbox shaded\"><strong>Note:<\/strong> your filter settings will not be stored in a QGIS Layer Style File.<\/div>\r\n&nbsp;\r\n\r\nIf you do not save a shapefile and its corresponding QGIS Style File in the same location, QGIS will not automatically symbolize the shapefile. However, you can manually apply the QGIS Style File to the shapefile.\r\n<ul>\r\n \t<li style=\"font-weight: 400\">In the table of contents, right-click the layer to which you would like to apply the symbology.<\/li>\r\n \t<li style=\"font-weight: 400\">Click Properties<\/li>\r\n \t<li style=\"font-weight: 400\">Click Information<\/li>\r\n \t<li style=\"font-weight: 400\">At the bottom of the window, click Load Style\u2026<\/li>\r\n \t<li style=\"font-weight: 400\">Click Browse<\/li>\r\n \t<li style=\"font-weight: 400\">Navigate to the location where you saved your QGIS Style File and double-click it.<\/li>\r\n \t<li style=\"font-weight: 400\">Click Load Style<\/li>\r\n<\/ul>\r\n<div class=\"textbox shaded\"><strong>Note:<\/strong> If you save a QGIS Layer Style File, please note that you must apply the style to the same layer (perhaps in a different project file) or to a layer that has the same structure. A different layer of the same structure would be one that is of the same geometry type (i.e., points, lines, or polygons) and that has the same attribute that was originally used for symbolization.<\/div>\r\n&nbsp;\r\n<h2>Saving a QGIS Layer Definition File (.qlr)<\/h2>\r\nIf you would like to create a new file that includes the shapefile and its symbolization, you can export the styled shapefile as a QGIS Layer Definition File (.qlr). When you add this file to a project, its style settings will automatically appear.\r\n\r\nThe key difference between a QGIS Layer Definition File and a QGIS Style File is that you can only use a Style File in conjunction with its corresponding shapefile. On the other hand, a Layer Definition File contains both the shapefile and its symbolization settings. QGIS treats it as a map layer unto itself.\r\n\r\nTo save a QGIS Layer Definition File,\r\n<ul>\r\n \t<li style=\"font-weight: 400\">In the table of contents, right-click the layer whose style you would like to save into a new QGIS Layer Definition File.<\/li>\r\n \t<li style=\"font-weight: 400\">Click Export<\/li>\r\n \t<li style=\"font-weight: 400\">Click Save as Layer Definition File\u2026<\/li>\r\n<\/ul>\r\n[caption id=\"attachment_843\" align=\"aligncenter\" width=\"684\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067.png\" alt=\"Figure 2.116. This shows the 1935 inventory region file selected, in the pop-up from the file export is highlighted and from that another pop-up, in which Save as a Layer Definition File is highlighted.\" width=\"684\" height=\"632\" class=\"size-full wp-image-843\" \/> <strong>Figure 2.116<\/strong>[\/caption]\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Save the file in an appropriate location, perhaps in a folder alongside any other data you are using for a project.<\/li>\r\n<\/ul>\r\nTo load a QGIS Layer Definition File,\r\n<ul>\r\n \t<li style=\"font-weight: 400\">Using the Browser pane, navigate to the location where you saved your QGIS Layer Definition File.<\/li>\r\n \t<li style=\"font-weight: 400\">Double-click the QGIS Layer Definition File to load it into your project.<\/li>\r\n<\/ul>\r\nHere, we saved the 1935 inventory region shapefile that we symbolized earlier in the chapter as a QGIS Layer Definition File and then loaded it into a new, blank project. Note that the symbolization settings and our filter have been retained without having to replicate them manually.\r\n\r\n[caption id=\"attachment_844\" align=\"aligncenter\" width=\"1093\"]<img src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069.png\" alt=\"Figure 2.117. This shows an updated map where only the 1935 inventory region shapefile is present.\" width=\"1093\" height=\"590\" class=\"size-full wp-image-844\" \/> <strong>Figure 2.117<\/strong>[\/caption]\r\n\r\nNote also that the QGIS Layer Definition File has the same attributes as the original shapefile from which it was created. You can verify this by opening the QGIS Layer Definition File\u2019s attribute table.\r\n<div class=\"textbox shaded\"><strong>Note:<\/strong> a QGIS Layer Definition File can only be created and reused in QGIS. It cannot be added to another GIS application, such as ArcGIS Pro.<\/div>\r\n&nbsp;\r\n\r\nWatch for a future chapter on Creating and Sharing a GeoPackage for information on how to save styles within a GeoPackage.\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;","rendered":"<p>After we have customized our layer\u2019s symbology and labels, there are a few ways in which we can reuse this styling. Reusing styles is useful for a couple of reasons. First, when we add a shapefile to QGIS, it will not show any symbology; we have to spend time designing its symbology. So, reusing our symbology allows us to quickly symbolize a newly added layer without having to spend time in the layer\u2019s Properties menu. Second, a key point of cartography is honesty in presentation of map data. Cartographers strive to present their map data as honestly and accurately as possible. By reusing styles across a series of maps, a cartographer can provide the necessary consistency for telling an honest story with his or her maps.<\/p>\n<p>For example, let\u2019s say that we not only had a shapefile containing forestry data for PEI for 1935 but also shapefiles containing forestry data for PEI in 1955, 1975, and 1995. Provided that the shapefiles were all polygons and all had exactly the same headers in their attribute tables, we could apply the same Graduated symbology style we created for the 1935 layer to the others. All of the layers would thus have the same class breaks and colour scheme, making for easy and accurate comparisons across each of the time points. As a bonus, we could also copy our labels to the other layers.<\/p>\n<h1>Copying a Style<\/h1>\n<p>Since we do not have the hypothetical forestry layers mentioned above, let\u2019s say that you would like to copy the styling that we created for the 1935 inventory region layer in this chapter\u2019s project file to the same layer in Chapter 1\u2019s project file. To quickly do so:<\/p>\n<ul>\n<li style=\"font-weight: 400\">Make sure that both projects are open. That is, make sure that you have two different windows of QGIS open, one with Chapter 1\u2019s project file and one with Chapter 2\u2019s project file.\n<ul>\n<li style=\"font-weight: 400\">On Windows, one good way to open two instances of QGIS is to have one QGIS window open, right-click the QGIS button in the Taskbar, and then click QGIS Desktop. A second instance of QGIS will open, and you can click Project and then Open to open another project, such as Project1.<\/li>\n<li style=\"font-weight: 400\">On a Mac, it is more difficult to have two projects open at once. However, you can still copy a layer and then open a different project (note that this will close your other project) and paste that layer into the Layers panel.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<figure id=\"attachment_836\" aria-describedby=\"caption-attachment-836\" style=\"width: 328px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image053.png\" alt=\"Figure 2.109. QGIS Desktop options.\" width=\"328\" height=\"178\" class=\"size-full wp-image-836\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image053.png 328w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image053-300x163.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image053-65x35.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image053-225x122.png 225w\" sizes=\"auto, (max-width: 328px) 100vw, 328px\" \/><figcaption id=\"caption-attachment-836\" class=\"wp-caption-text\"><strong>Figure 2.109<\/strong><\/figcaption><\/figure>\n<ul>\n<li style=\"font-weight: 400\">In the QGIS window containing the project that features the layer whose style you would like to copy, right-click this layer and click Styles, and then Copy Styles, and then All Style Categories.<\/li>\n<\/ul>\n<figure id=\"attachment_837\" aria-describedby=\"caption-attachment-837\" style=\"width: 883px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055.png\" alt=\"Figure 2.110. QGIS window containing the project that features the layer whose style you would like to copy, right-click this layer and click Styles, and then Copy Styles, and then All Style Categories.\" width=\"883\" height=\"676\" class=\"size-full wp-image-837\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055.png 883w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055-300x230.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055-768x588.png 768w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055-65x50.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055-225x172.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image055-350x268.png 350w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><figcaption id=\"caption-attachment-837\" class=\"wp-caption-text\"><strong>Figure 2.110<\/strong><\/figcaption><\/figure>\n<ul>\n<li style=\"font-weight: 400\">In the QGIS window containing the project that features the layer onto which you would like to copy the style, right-click this layer and click Styles, and then Paste Style, and then All Style Categories.<\/li>\n<\/ul>\n<figure id=\"attachment_838\" aria-describedby=\"caption-attachment-838\" style=\"width: 1539px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057.png\" alt=\"Figure 2.111. This image shows the QGIS window with the 1935 inventory layer selected, with a pop-up where the second last option (Styles) is highlighted. From this first pop-up stems a second pop-up where the second option (Paste Style) is highlighted. The final pop-up that stems from the second has the first option (All Style Categories) selected.\" width=\"1539\" height=\"923\" class=\"size-full wp-image-838\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057.png 1539w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-300x180.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-1024x614.png 1024w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-768x461.png 768w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-1536x921.png 1536w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-65x39.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-225x135.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image057-350x210.png 350w\" sizes=\"auto, (max-width: 1539px) 100vw, 1539px\" \/><figcaption id=\"caption-attachment-838\" class=\"wp-caption-text\"><strong>Figure 2.111<\/strong><\/figcaption><\/figure>\n<p>Here is the result of the paste:<\/p>\n<figure id=\"attachment_839\" aria-describedby=\"caption-attachment-839\" style=\"width: 1101px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059.png\" alt=\"Figure 2.112. Updated map with the pasted layer results.\" width=\"1101\" height=\"590\" class=\"size-full wp-image-839\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059.png 1101w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059-300x161.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059-1024x549.png 1024w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059-768x412.png 768w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059-65x35.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059-225x121.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image059-350x188.png 350w\" sizes=\"auto, (max-width: 1101px) 100vw, 1101px\" \/><figcaption id=\"caption-attachment-839\" class=\"wp-caption-text\"><strong>Figure 2.112<\/strong><\/figcaption><\/figure>\n<div class=\"textbox shaded\"><strong>Note<\/strong>: when you copy and paste styles between layers in QGIS, it does not copy your filter settings.<\/div>\n<p>&nbsp;<\/p>\n<div class=\"textbox shaded\"><strong>Note<\/strong>: you can only copy and paste styles between layers in QGIS. It will not work between QGIS and another GIS application, such as ArcGIS Pro.<\/div>\n<p>&nbsp;<\/p>\n<div class=\"textbox shaded\"><strong>Note:<\/strong> if you copy a style, please note that you must apply the style to the same layer (perhaps in a different project file) or to a layer that has the same structure. A different layer of the same structure would be one that is of the same geometry type (i.e., points, lines, or polygons) and that has the same attribute that was originally used for symbolization.<\/div>\n<h1>Saving a Style<\/h1>\n<p>The process outlined above for copying a style is effective for times when you only need to copy a style once and quickly paste it onto another layer. However, if you wish to save your style permanently, you have a few options.<\/p>\n<h2>Saving a QGIS Style File (.qml)<\/h2>\n<p>A QGIS Style File (.qml) offers much of the same functionality as the process of copying and pasting symbology, but it allows you to permanently save this symbology instead of temporarily storing it on your clipboard. It also allows you to have a layer\u2019s symbology load automatically when the layer is added to a project.<\/p>\n<p>To save a QGIS Style File:<\/p>\n<ul>\n<li>In the table of contents, right-click the layer whose style you would like to save.<\/li>\n<li>Click Properties\u2026<\/li>\n<li>Click Information.<\/li>\n<li>At the bottom of the Information window, click Style and then Save Style\u2026<\/li>\n<\/ul>\n<figure id=\"attachment_840\" aria-describedby=\"caption-attachment-840\" style=\"width: 835px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061.png\" alt=\"Figure 2.113. At the bottom of the Information window, Style is selected and a pop-up appears in which Save Style is selected.\" width=\"835\" height=\"805\" class=\"size-full wp-image-840\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061.png 835w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061-300x289.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061-768x740.png 768w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061-65x63.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061-225x217.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image061-350x337.png 350w\" sizes=\"auto, (max-width: 835px) 100vw, 835px\" \/><figcaption id=\"caption-attachment-840\" class=\"wp-caption-text\"><strong>Figure 2.113<\/strong><\/figcaption><\/figure>\n<ul>\n<li style=\"font-weight: 400\">Click Browse<\/li>\n<\/ul>\n<figure id=\"attachment_841\" aria-describedby=\"caption-attachment-841\" style=\"width: 535px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063.png\" alt=\"Figure 2.114. This shows the Save Layer Style page. Under the save file information is the option to browse.\" width=\"535\" height=\"576\" class=\"size-full wp-image-841\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063.png 535w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063-279x300.png 279w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063-65x70.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063-225x242.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image063-350x377.png 350w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\" \/><figcaption id=\"caption-attachment-841\" class=\"wp-caption-text\"><strong>Figure 2.114<\/strong><\/figcaption><\/figure>\n<ul>\n<li style=\"font-weight: 400\">Navigate to the folder in which the layer from which we are saving the style (i.e., the original layer) is stored. In this case, navigate to the folder called Project1\\Data\\forest_35.SHP.\n<ul>\n<li style=\"font-weight: 400\">If you need a reminder as to its location, check the \u201cPath\u201d field in the Information window.<\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\">Next to File name, type in the name of the shapefile associated with this style file. We want the original shapefile and the QGIS Style File to have the same name.\n<ul>\n<li style=\"font-weight: 400\">Although the two files will have the same name, their extensions will differ. The shapefile will be called 1935 inventory_region.shp while its corresponding QGIS Style File will have the name 1935 inventory_region.qml.<\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\">Click Save<\/li>\n<\/ul>\n<p>If you open a new project and add the 1935 inventory_region shapefile from the forest_35.SHP folder, it will be automatically symbolized according to the settings stored in the QGIS Style File that we just saved. This is done automatically because the shapefile and QGIS Style Files were stored in the same folder and were given the same name.<\/p>\n<p>Here, we added the shapefile from the forest_35.SHP folder, and QGIS automatically loaded the corresponding QGIS Style File.<\/p>\n<figure id=\"attachment_842\" aria-describedby=\"caption-attachment-842\" style=\"width: 1095px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065.png\" alt=\"Figure 2.115. This is an updated map with the shapefile from the forest_35.SHP folder.\" width=\"1095\" height=\"590\" class=\"size-full wp-image-842\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065.png 1095w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065-300x162.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065-1024x552.png 1024w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065-768x414.png 768w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065-65x35.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065-225x121.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image065-350x189.png 350w\" sizes=\"auto, (max-width: 1095px) 100vw, 1095px\" \/><figcaption id=\"caption-attachment-842\" class=\"wp-caption-text\"><strong>Figure 2.115<\/strong><\/figcaption><\/figure>\n<div class=\"textbox shaded\"><strong>Note:<\/strong> your filter settings will not be stored in a QGIS Layer Style File.<\/div>\n<p>&nbsp;<\/p>\n<p>If you do not save a shapefile and its corresponding QGIS Style File in the same location, QGIS will not automatically symbolize the shapefile. However, you can manually apply the QGIS Style File to the shapefile.<\/p>\n<ul>\n<li style=\"font-weight: 400\">In the table of contents, right-click the layer to which you would like to apply the symbology.<\/li>\n<li style=\"font-weight: 400\">Click Properties<\/li>\n<li style=\"font-weight: 400\">Click Information<\/li>\n<li style=\"font-weight: 400\">At the bottom of the window, click Load Style\u2026<\/li>\n<li style=\"font-weight: 400\">Click Browse<\/li>\n<li style=\"font-weight: 400\">Navigate to the location where you saved your QGIS Style File and double-click it.<\/li>\n<li style=\"font-weight: 400\">Click Load Style<\/li>\n<\/ul>\n<div class=\"textbox shaded\"><strong>Note:<\/strong> If you save a QGIS Layer Style File, please note that you must apply the style to the same layer (perhaps in a different project file) or to a layer that has the same structure. A different layer of the same structure would be one that is of the same geometry type (i.e., points, lines, or polygons) and that has the same attribute that was originally used for symbolization.<\/div>\n<p>&nbsp;<\/p>\n<h2>Saving a QGIS Layer Definition File (.qlr)<\/h2>\n<p>If you would like to create a new file that includes the shapefile and its symbolization, you can export the styled shapefile as a QGIS Layer Definition File (.qlr). When you add this file to a project, its style settings will automatically appear.<\/p>\n<p>The key difference between a QGIS Layer Definition File and a QGIS Style File is that you can only use a Style File in conjunction with its corresponding shapefile. On the other hand, a Layer Definition File contains both the shapefile and its symbolization settings. QGIS treats it as a map layer unto itself.<\/p>\n<p>To save a QGIS Layer Definition File,<\/p>\n<ul>\n<li style=\"font-weight: 400\">In the table of contents, right-click the layer whose style you would like to save into a new QGIS Layer Definition File.<\/li>\n<li style=\"font-weight: 400\">Click Export<\/li>\n<li style=\"font-weight: 400\">Click Save as Layer Definition File\u2026<\/li>\n<\/ul>\n<figure id=\"attachment_843\" aria-describedby=\"caption-attachment-843\" style=\"width: 684px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067.png\" alt=\"Figure 2.116. This shows the 1935 inventory region file selected, in the pop-up from the file export is highlighted and from that another pop-up, in which Save as a Layer Definition File is highlighted.\" width=\"684\" height=\"632\" class=\"size-full wp-image-843\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067.png 684w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067-300x277.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067-65x60.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067-225x208.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image067-350x323.png 350w\" sizes=\"auto, (max-width: 684px) 100vw, 684px\" \/><figcaption id=\"caption-attachment-843\" class=\"wp-caption-text\"><strong>Figure 2.116<\/strong><\/figcaption><\/figure>\n<ul>\n<li style=\"font-weight: 400\">Save the file in an appropriate location, perhaps in a folder alongside any other data you are using for a project.<\/li>\n<\/ul>\n<p>To load a QGIS Layer Definition File,<\/p>\n<ul>\n<li style=\"font-weight: 400\">Using the Browser pane, navigate to the location where you saved your QGIS Layer Definition File.<\/li>\n<li style=\"font-weight: 400\">Double-click the QGIS Layer Definition File to load it into your project.<\/li>\n<\/ul>\n<p>Here, we saved the 1935 inventory region shapefile that we symbolized earlier in the chapter as a QGIS Layer Definition File and then loaded it into a new, blank project. Note that the symbolization settings and our filter have been retained without having to replicate them manually.<\/p>\n<figure id=\"attachment_844\" aria-describedby=\"caption-attachment-844\" style=\"width: 1093px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069.png\" alt=\"Figure 2.117. This shows an updated map where only the 1935 inventory region shapefile is present.\" width=\"1093\" height=\"590\" class=\"size-full wp-image-844\" srcset=\"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069.png 1093w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069-300x162.png 300w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069-1024x553.png 1024w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069-768x415.png 768w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069-65x35.png 65w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069-225x121.png 225w, https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-content\/uploads\/sites\/53\/2022\/02\/image069-350x189.png 350w\" sizes=\"auto, (max-width: 1093px) 100vw, 1093px\" \/><figcaption id=\"caption-attachment-844\" class=\"wp-caption-text\"><strong>Figure 2.117<\/strong><\/figcaption><\/figure>\n<p>Note also that the QGIS Layer Definition File has the same attributes as the original shapefile from which it was created. You can verify this by opening the QGIS Layer Definition File\u2019s attribute table.<\/p>\n<div class=\"textbox shaded\"><strong>Note:<\/strong> a QGIS Layer Definition File can only be created and reused in QGIS. It cannot be added to another GIS application, such as ArcGIS Pro.<\/div>\n<p>&nbsp;<\/p>\n<p>Watch for a future chapter on Creating and Sharing a GeoPackage for information on how to save styles within a GeoPackage.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"author":31,"menu_order":5,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[48],"contributor":[],"license":[],"class_list":["post-727","chapter","type-chapter","status-publish","hentry","chapter-type-numberless"],"part":623,"_links":{"self":[{"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/chapters\/727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/wp\/v2\/users\/31"}],"version-history":[{"count":4,"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/chapters\/727\/revisions"}],"predecessor-version":[{"id":907,"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/chapters\/727\/revisions\/907"}],"part":[{"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/parts\/623"}],"metadata":[{"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/chapters\/727\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/wp\/v2\/media?parent=727"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/pressbooks\/v2\/chapter-type?post=727"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/wp\/v2\/contributor?post=727"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.library.upei.ca\/geospatialhumanities\/wp-json\/wp\/v2\/license?post=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}