5

I got two layers: (1) a line layer with water pipelines and (2) a point layer that shows hydrants and so forth. The points are located, mostly, on the line layer.

For the symbology of the hydrants i want to use a simple marker half_square / rectangle that should be rotated 90° to the line layer.

My approach would be to use an expression for the rotation, but i have no idea how that expression has to look.

Taras
  • 32,823
  • 4
  • 66
  • 137
Nunkuat
  • 485
  • 2
  • 11

1 Answers1

8
  1. Find the nearest line using overlay_nearest
  2. Buffer the point and intersect the buffer with the line to cut out a short segment of the line
  3. Find the angle of this using line_interpolate_angle

With this expression:

line_interpolate_angle(
geometry:=intersection(buffer(geometry:=$geometry, distance:=100, segments:=3),
overlay_nearest(layer:='railways', expression:=$geometry)[0]), distance:=20)+90

You probably need to play around with the distances to get the best result.

enter image description here

zxcxz

enter image description here

BERA
  • 72,339
  • 13
  • 72
  • 161