3

I changed the symbolization of my .shp data such that I classified it instead of one single symbol. Is there a way I can save the .shp that will keep the changes and when I load the layer in QGIS next time, it pops up with the changes made?

1
  • 1
    Shapefiles do not contain symbology rules. Esri uses layerfiles for this (.lyr), so you need to ask about an equivalent in QGIS.
    – Vince
    Jul 3, 2018 at 11:21

2 Answers 2

8

.shp only hold geometry and attribute, you can't save style in it (in an universal way).

That being said there is two qgis specific way to achieve what you want :

First use a .qml : .qml file are style file and do not reference a specific layer (you may use the same style with any data source of the same geometric type if the field used for the symbology are the same), you do have to apply it to a layer but if you give your style the same name as your .shp and save it to the same location as your .shp the style should be automatically applied each time you open your shapefile.

To create a .qml : right click your layer go to properties, Symbology tab then click the style button at the bottom left OR right click your layer go to export and save as qgis layer style file

Second use a .qlr : .qlr are file that reference a specific layer whith a specific symbology (equivalent of .lyr in arcgis), these file appear in the qgis browser as a datasource and can be directly added

To create a .qlr : right click your layer go to export and save as layer definition file

1
  • 2
    It's .qml not .qld "QGIS Layer Style File". You can also choose the "Save as Default" which will create the .qml file with the same name automatically. Jul 3, 2018 at 11:37
4

A more modern option that beats the traditional Shapefile and .qlr approach is to make use of the newer OGC-compliant GeoPackage standard. GeoPackages are the newest method of storing Vector and Raster layers, similar in function to the ESRI GeoDatabase (.gdb) as they allow you to save multiple layers within the same file. They're also a standard format supported in QGIS 3.

Start by converting your shapefile to a GeoPackage using either QGIS 3 or GDAL. This will create a new file GeoPackage file with one layer (you can add other layers to this if you want to). After that, load this file and create your symbology by modifying the properties in your layer configuration.

When saving your style, you'll find a new option that says "Save in database (GeoPackage)". You can name your style and set a description but be sure to check the box that says "Use as default style for this layer". By checking that, whenever you load that layer from your GeoPackage, the style will be set to your default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.