I would like to split a linelayer with points in QGIS. For that, i found this answer: Splitting line with point layer in QGIS
I have one point layer: QBW_Strukturgütekartierung and one line layer: FWK_GESAMT
I used the following code in 'Geometry by expression'. Hereby my input layer is my line layer. And the 'point' expression in the code line 4 is my point layer.
collect_geometries (
array_foreach (
aggregate(
'point',
'array_agg',
$geometry),
extend (
make_line(
line_interpolate_point(
$geometry,
line_locate_point($geometry,@element)
),
project (
line_interpolate_point(
$geometry,
line_locate_point($geometry,@element)
),
10,
radians(
90+line_interpolate_angle(
$geometry,
line_locate_point($geometry,@element)
)))),
10,
0
)))
The problem is that i had a multipoint layer but did not refer to it in the expression.
The problem was solved by using the following expression in the sixth line of the code:
geometry_n($geometry,1)
My data structure looks like the following:
- The point layer has 10,857 entries with multiple features.
- The line layer has 558 entries with multiple features.
- Both the line and point layer share one attribute thats the same. The name of the river.
Is this enough insight into the data or is more needed?
I am not allowed to share the data. I am rather new to QGIS.
@she_weeds answered that I could generate an auxiliary line at every point on the line with the following code in 'geometry by expression'. I substituted point_layer_name with my point layer and attribute_name with the attribute the point and line layer share:
collect_geometries (
array_foreach (
aggregate(
'point_layer_name',
'array_agg',
geometry_n($geometry,1),
filter:="attribute_name"=attribute(@parent,'attribute_name')
),
extend (
make_line(
line_interpolate_point(
$geometry,
line_locate_point($geometry,@element)
),
project (
line_interpolate_point(
$geometry,
line_locate_point($geometry,@element)
),
10,
radians(
90+line_interpolate_angle(
$geometry,
line_locate_point($geometry,@element)
)))),
10,
0
)))
However, there are still more lines created than i actually wanted. I also tried the other suggestions but the solutions were not as sufficient.
Any more suggestions?

