5

I am trying to apply a rule to rotate symbols based on the value of an attribute.

I tried to copy Automatically changing the angle of a symbol in QGIS?, which is essentially my question, however it does not work for me.

I have a layer with two attributes, the slope and aspect. I want to colour the symbols by the slope (this part works) and rotate by the aspect.

The steps I take are:

  1. Layer Properties -> Style -> Graduated -> Symbol -> Change

  2. Select Simple Marker (arrow) and press the button to the right of angle -> field type (double) -> Aspect-sel

Applying these commands changes the symbol to an arrow, and I can easily apply the colour gradient, but the symbols do not rotate. The attribute Aspect-sel varies from 2.87 to 334.23.

enter image description here

ETA: I was using Version 2.8.3 - on suggestion I updated to 2.14.10, which solved the problem.

6

If you want to use a field in attribute table, you should select the field directly in the Data defined override which has the angle value. The field should be of double/integer type not string field type. In the following figure I used at first Single Symbol and select Data defined override beside the rotation field, as you can see below:

enter image description here

Then, I changed the style from Single Symbol to Graduated and select another field (in your case slope field), as you can see below.

enter image description here

  • Thanks for the example, the only difference I can see with what you have posted is that the Data defined override is available at the Marker level, rather than the Simple Marker level. That option isn't available in my version (2.8.3). Which version are you using? I'm wondering if there's a bug in the version I'm using. – Esme_ Jan 11 '17 at 5:59
  • 2
    I have QGIS 2.14.8. May be you need to update your QGIS version to the latest which is now LTR 2.14.10. But the Data defined override is also available at simple marker. – ahmadhanb Jan 11 '17 at 6:01
  • It is located beside the Angle similar to the figure posted in your question. Make sure the field type is Double/integer not string. – ahmadhanb Jan 11 '17 at 6:08
  • The field type is double - so I suspect that there was a bug that a later version fixed. Time to upgrade I guess. – Esme_ Jan 12 '17 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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