# Calculating distance between matching intersections using QGIS?

I have a streetmap with the coordinates of some speed limit signs (which mark either the beginning or the ending of a speed limit and hold the applicable speed limit in km/h). With regard to the direction of driving, the signs are always positioned on the right side of the road:

What I want to do now is to create a new line layer which shows the speed sections (the length in km of the speed section and the speed limit in km/h itself).

As you can see the red rectangle in the image above, I will cover the marked area in an example:

In order to do that, I guess I will have to create normal vectors with the points of the speed signs and the streets itself in order to get intersections directly on the streetline. I know how to do that by now. But how can I "drive" along the streetline to sequentially check each speed sign in order to extract the speed sections? Let's take the picture above as an example: If I start south at the beginning of the 70 km/h speedsection, I have to drive north (because it is the driving direction of the street) and check each speed sign along the line for the end of the speed section. After that, I search for the next beginning speed section and so on.

How can that be realized? Please comment if you need more details on that issue.

• And a point layer `speed_signs` has `speed` field.
• The driving azimuth at the start point (node 0) "A" is given by `angle_at_vertex( \$geometry, vertex:=0 )` this is a clockwise angle starting from north.
• From the start point, the speed post (40 km/h) should be on the right hand side, its direction (from the start point) "B" is ```azimuth(start_point(\$geometry), geomnearest(‘speed_signs’, ‘\$geometry’)) ``` (please note `geomnearest()` function is from refFunction plugin). Probably `degrees()` is required to convert the radians to degrees.
• To avoid another nearby speed sign (on the opposite side; 30 km/h), the angle between the road and the speed post (`B - A`) has to be less than 180 degrees. Conditional statement something like `CASE WHEN (B - A) < 180 THEN...` would be useful.
• Then the speed data can be taken, again by using refFunction `geomnearest('speed_signs', 'speed')`.