Hi All,
I am trying to format labels associated with dip and strike symbols on geological maps. The traditional way is to plot the dip value next to the small tick on the dip/strike symbol. The problem is how to move the label automatically to where the little tick mark is. I am thinking the geometry generator should be able to do this with an expression like move the label to a quadrant based on the dip direction at a set distance from the centroid of the symbol.
Has anyone managed to do this?
Cheers Grant
Hi All,
I think I have answered my own question. See description below.
Check to see which is the required field to control the label location. In this example it is the dip direction. Set the label placement options to “Offset from point”, open the data-driven override next to the Quadrant icons. Enter the CASE statement as shown below.


Note the location of the label as referenced from the centroid of the dip-strike symbol.
0 = above left, 1 = above, 2 = above right, 3 = left, 4 = over, 5 = right, 6 = below left, 7 = below, 8 = below right.
Grant Boxer, May 2025.
--
You received this message because you are subscribed to the Google Groups "QGIS Australia User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to australian-qgis-use...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/australian-qgis-user-group/022f01dbc2dd%24ab7cb7c0%2402762740%24%40iinet.net.au.
| North Road Cartography • Development • Spatial Analysis north-road.com QGIS User Conference 2025 2-3 June, Norrköping, Sweden FOSS4G 2025 17-23 November, Auckland, New Zealand |
To view this discussion, visit https://groups.google.com/d/msgid/australian-qgis-user-group/00a201dbc31a%24caddc860%2460995920%24%40iinet.net.au.
In order to replicate a geological survey-type map appearance where dip values are placed relative to the orientation of the symbol rotation, such as what is shown on the example above, then some coding is required in the labelling Placement options and using the Offset from Point mode.
For classic dip and strike type symbols the data defined override code expects a string formatted as X,Y as follows:
to_string((-4*cos(radians( "DipDirection"+90))) )|| ',' || to_string(-5 * sin(radians( " DipDirection "+90 )))
· The code assumes that a DipDirection field exists (representing the dip direction). If your field name is different, then this is where it can be changed.
· The two 90 values relate to the initial orientation of the symbol (where no rotation is applied) and can be adjusted to suit. In my example the symbol tick points in the eastward direction by default and requires a -90 correction. Easy to change if your symbols start facing north in which case remove the '+90' bit in each case.
· The -4 and -5 control the distance for the label to be placed from the centre of the symbol and can be changed to suit your own preference.
Hi Colin,
Many thanks for that. I thought someone must have done it somewhere.
Where do I place the code string? I have tried a few places but doesn’t seem to work for me.
Cheers Grant
From: australian-qg...@googlegroups.com <australian-qg...@googlegroups.com> On Behalf Of Colin Mazengarb
Sent: Tuesday, 13 May 2025 5:04 PM
To: QGIS Australia User Group <australian-qg...@googlegroups.com>
Subject: Re: [QGIS-Australia-User-Group] Plotting geological dips against a dip/strike symbol
Hi Grant,
here is my method for labelling. I also use rule-based labelling for excluding vertical and horizontal values where no value is required. Note that I discovered this code from an Irish QGIS website many years ago so cannot claim originality.
Hoping this is helpful.
cheers
Colin
Controlling dip value labelling
In order to replicate a geological survey-type map appearance where dip values are placed relative to the orientation of the symbol rotation, such as what is shown on the example above, then some coding is required in the labelling Placement options and using the Offset from Point mode.
For classic dip and strike type symbols the data defined override code expects a string formatted as X,Y as follows:
to_string((-4*cos(radians( "DipDirection"+90))) )|| ',' || to_string(-5 * sin(radians( " DipDirection "+90 )))
· The code assumes that a DipDirection field exists (representing the dip direction). If your field name is different, then this is where it can be changed.
· The two 90 values relate to the initial orientation of the symbol (where no rotation is applied) and can be adjusted to suit. In my example the symbol tick points in the eastward direction by default and requires a -90 correction. Easy to change if your symbols start facing north in which case remove the '+90' bit in each case.
· The -4 and -5 control the distance for the label to be placed from the centre of the symbol and can be changed to suit your own preference.
On Tuesday, May 13, 2025 at 9:17:36 AM UTC+10 em...@north-road.com wrote:
Thanks Grant!
To view this discussion, visit https://groups.google.com/d/msgid/australian-qgis-user-group/8371c7b8-2106-4c69-af78-63e72ab9fb47n%40googlegroups.com.

Great thanks, will give it a go,