With two layers, one multiline and one point, I need to split lines who intersect point layer.
In example (image), the selected line is unique but I need 11 lines cut at point level.
How can I do this with QGIS?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
Using only QGIS native tools, you can convert the points to small, auxiliary lines, perpendicular to the line you want to split. Then use Split with lines.
To create the auxiliary lines, use this expression with Geometry by Expression on the line layer. Replace
point (line 4) with the name of your 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 )))
Use the newly created auxiliary lines to split the initial line into segments.
Screenshot: the small red auxiliary lines are created (here: with geometry generator) on the line-layer, based on the points. As you see from the colors, the line is then split at these points:
Let's assume there are two layers 'lines_test' (blue) and 'points_test' (orange), see image below.
Step 1. By means of the "Geometry by expression" with the following expression:
make_line($geometry, translate($geometry, 10, 10))
create tiny lines starting/ending at those points
On this step a smarter approach may be required, thus tiny lines should not overlap with initial lines. I would probably refer to these threads then: Perpendicular lines on line using QGIS and Creating line segments at point coordinates in QGIS.
Step 2. Use the "Split with lines" with the result from the Step 1 and get the final output