QGIS individual symbol rotation

2018-03-16 10:49:47

I've digitised some symbols in QGIS (2.14.1) as a new Shapefile point layer. I want the symbols to be rotated to different angles.

I've worked out that I can have a data defined rotation field in my attribute table and I've put this in and it seems to be working. However I can't workout if there is a way to rotate the symbol in the map window and have that update in the attribute table: so I'm stuck with putting values into my attribute table manually.

I know how I can rotate label with the Label Toolbar so I really hope that there is a similar function for symbol rotation.

You can achieve this easily with the use of an additional vector line layer. The idea is to assign an angle value from a line you create to the point layer symbol via joining both layers.

Working example:

I. Having a point layer symbol_point with 5 features and the corresponding attributes id (for joining), angle (stands for the old given angle), descr.

II. Having a line layer rotation_line

  • You can achieve this easily with the use of an additional vector line layer. The idea is to assign an angle value from a line you create to the point layer symbol via joining both layers.

    Working example:

    I. Having a point layer symbol_point with 5 features and the corresponding attributes id (for joining), angle (stands for the old given angle), descr.

    II. Having a line layer rotation_line holding the attributes id (for joining), line_angle.

    Workflow

    Enable snapping on the point layer: Settings > Snapping Options > Layer selection: Advanced. Choose your layer and set Mode to vertex and the tolerance.

    Go to Properties > Fields > Text Edit of the field line_angle of the line layer. There you set the Default Value to to_int(degrees(azimuth(start_point($geometry ),end_point($geometry)))) like shown in this picture. This updates the field line_angle after you've create the line with the azimuth of the line. You have to start at the point, otherwise you get the "opposite" azimuth!

    2018-03-16 11:23:12
  • For showing respective rotation to the symbols first you need to have rotation value for every points in the attribute table. Then go to

    properties

    style tab

    click on symbol

    Then on the right hand side of the rotation click on data defined override.

    then under field type select your respective rotation column name.

    Then click on apply button.

    2018-03-16 11:33:35
  • In QGIS 3 this is a build in feature.

    Create the layer as before:

    With a rotation column that has 0 to begin with. Make sure to set up the data defined override for the symbology. In my case I did it for both the square and the question mark that made up my symbology.

    Then using the "Rotate Point Symbols" tool from the advanced digitizing toolbar. You can rotate the point.

    Success:

    2018-03-16 12:28:07