2

I've got one layer with a line (e. g. a road) and one layer with points (e. g. trees along the road). So far, the points are placed right on the line, but the attribute table of the point layer has a column called "distance", that lists the distance of the trees to the middle of the road. So is there a possibility to automatically offset the points from the line by the individual distance value?

5
  • This should be perfectly doable using translate geometry with data defined override incorporating Pythagoras after adding the line angle to the points.
    – Erik
    Jun 2, 2022 at 9:28
  • Is there a relation between roads and trees? I.e. does the tree layer have the road id as attribute?
    – geozelot
    Jun 2, 2022 at 9:40
  • @geozelot: Yes, the road ID is another attribute of the tree layer.
    – Radar Cake
    Jun 2, 2022 at 9:47
  • ...and is there a relative side attribute or rule? E.g. 'to the right, in direction of the linestring'?
    – geozelot
    Jun 2, 2022 at 10:07
  • Yes, if the number is positive, the tree stands at the right side, left is negative
    – Radar Cake
    Jun 2, 2022 at 10:17

1 Answer 1

2

You can use the Expression String Builder on the Offset X, Y of the Label Placement using something like Array("distance",0). If the distance is in meters use Meters at Scale for example.

enter image description here

EDIT: Miss-read your question and I thought you want to place the label. So if you want to place the symbol based on the distance offset you can do something similar and use the Offset property of the Single Symbol.

enter image description here

1
  • Wow, thats much easier than I expected! It works perfectly, thank you very much! :-)
    – Radar Cake
    Jun 2, 2022 at 12:55

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.