3

I have spent the day attempting this to no avail...I am a bit of a newbie to QGIS, but please help!

I am trying to import the files at the bottom of: https://www.fscbiodiversity.uk/?q=QGISHabitatStyles

I am running 2.18 Las Palmas

They are all QML files - in QGIS I have created a new layer > properties, and want to match the new polygon with one of the styles. I have tried using the Style > load style process to no avail - the polygon changes to a style and refuses to match the style required.

Basically - how do I get all of the above styles to use as a palette (that opens every time) in QGIS?

3 Answers 3

6

I think your problem is understanding that a QML file is a style only for a specific dataset (or related dataset with the same structure) and not a file that provide you with a palette or a set of symbol that you can reuse for any data.

For exemple you may have a QML that will symbolise road based on a specific attribute, this is useful if your road data are separated in different file for different region as you could use the same QML to get the same symbology on all your road data.


If you want to use a QML on another kind dataset you will need to made sure that :

  • both dataset are of the same geometry type.
  • the attribute used for classification exist and is filled with the correct value.

In your case you will need to have a 'stylecode' column as stated in :

The QML file expects this attribute to be called 'stylecode'

and you need to fill each attribute of this column by the correct value, one of them beeing 'FDC' as stated in

for example, Ben's 'Fen-dominated communites' gets the abbreviation 'FDC'. These abbreviations must be recorded in an attribute in your shapefile in order to use the QML file

1

If you look closely at the layer window in the screenshots of your linked website, you'll notice the small grey polygonal blob floating there - this indicates a classified style. The data on that website is all in one layer and has some attribute which allows for identification of the classes - and proper display based upon this classes.

So you a) have to find out, based on which column and which values within this column the classification happens and b) apply this to your data.

/edit:

This file is also included in the download file at the foot of this article. Ben's schema brigades NVC codes into related groups (as shown in the QGIS legend above) and to make this easy to use in QGIS, I abbreviated each of these groups (as seen in the labels in the map image); so, for example, Ben's 'Fen-dominated communites' gets the abbreviation 'FDC'. These abbreviations must be recorded in an attribute in your shapefile in order to use the QML file I have created. The QML file expects this attribute to be called 'stylecode'. Of course you should also have another shapefile attribute with the full NVC code so that you can label individual polygons with their codes.

Here's how to name the column and what values you need.

2
  • Hi Erik, thanks for the answer, when it says 'must be recorded as an attribute in your shapefile' how do I do this? (apologies, newbie shame!).....a bit more detail would be most helpful! Cheers. Commented Dec 19, 2018 at 15:48
  • Feel free to complete any online tutorial on how to alter the attribute table and/or a shape file in QGis. I wouldn't tell you anything else.
    – Erik
    Commented Dec 19, 2018 at 15:50
1

You can use Set layer style algorithm for that (menu Processing > Toolbox, then search for Set layer style or simply qml). It adds style to chosen layer.

Your Answer

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

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