# Making marker label rotate with marker using QGIS

I have an arrow marker (svg) that I use for photo location and direction on maps.

Under the arrow I want a label that is the number of the photo (photos by number are located elsewhere in a report). The number will have a white circle background. I can achieve this using Offset from Point and defining the quadrant and y value. Works for the arrow always pointing north. :)

The problem is that I cannot identify how to make the label rotate with the arrow marker/symbol such that it is always "under" the arrow (yet still oriented correctly as text).

As you can see, the arrow for image 2 points east but the label has not changed its position to still be inside the chevron.

"Use data defined properties for rotation with the same field on both marker and label"

Any online guide that explains this process?

I don't even understand the terms you are using.

Subsequent to the answer with examples:

After inputing the parameters you suggested (cutting and pasting your coding) it gave the message "Result of the expression is not a geometry."

And the result was that the circle and number disappear altogether.

project (make_point (\$x,\$y), 1, radians(45)) version below

• Please provide an example image.
– Erik
Mar 31, 2022 at 13:16
• Use data defined properties for rotation with the same field on both marker and label
– J.R
Mar 31, 2022 at 14:41

Use Geometry Generator for label placement with `Offset from point` and use this expression (see below for variants A)if the solution should fit different map scales and B) if the labels itself should also be rotated):

``````project (
make_point (\$x,\$y),
2500,  -- change the distance to fit your needs
-radians(180 - "rotation") -- rotation is the name of the attribute containing rotation values
)
``````

The red dot indicates the actual point geometry; the value of 2500 in the above expression is the distance from this point:

If you zoom in and out, a fixed distance is not ideal as the label moves too far away from or comes too close to the arrow. To fit different scales, use a small distance value and multiply it with the variable `@map_scale`:

``````project (
make_point (\$x,\$y),
0.016 *  @map_scale,
If you want to rotate the labels as well, go down to `Data defined` and set a data driven override for `Rotation`, where you just set the attribute that contains the rotation angle (the same you used for the arrows).
• Do you have an attribute named `rotation`? If not, replace this part in the expression with the ratation value you have. If it still doesn't work: can you provide sample data? Mar 31, 2022 at 22:25
• Please test: does `make_point (\$x,\$y)` produce a geometry? If so, try `project (make_point (\$x,\$y), 1, radians(45))` - what happens then? Mar 31, 2022 at 22:35