Tuesday 1 November 2016

symbology - Rotating symbols per attribute value in QGIS?


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.



Answer



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


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...