In QGIS with this expression I can place points along a line at a given distance

with_variable (
collect_geometries (
    array_foreach (
        generate_series (0,@no-1,1),
            length($geometry) / @no * @element 
            + length($geometry) / @no / 2


But is there a way to put a label with the distance from the origin enter image description here

  • Have you tried repeating labels?
    – Erik
    Commented Jan 2 at 9:44

1 Answer 1


Using Geometry Generator, you just create a new style for each feature. So all the points along the line are in fact one single (multipoint) feature/style and because of that, you can't label them individually.

Use Geometry by Expression instead with your expression to create actual points, convert Multipart to Single parts and then use the following expression to label these points (replace line with the name of your line layer):

  • It doesn't work because there is no point layer, Points re just a style created with the generated geometry
    – Eduardo
    Commented Jan 2 at 14:19
  • What doesn't work? If you follow the instructions, you generate a point layer, based on your expression and you can than label this layer. Exactly because a geometry generator created style is not a layer, you won't be able to label these points individually. Or didn't I understand a point?
    – Babel
    Commented Jan 2 at 14:22
  • My question was how to create the label without creating a new layer with the points, I understand that that is not possible, right?
    – Eduardo
    Commented Jan 2 at 15:26
  • Indeed, you need to create another layer for that.
    – Babel
    Commented Jan 2 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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