Several line segments intersect one large poly line. How I can insert point feature at intersections, 25m south and north of large poly-line?
1 Answers
Using network
You can create the intersection and then use network algorithm to get the service area of 25 m from the intersection.
In details:
Use
Menu Processing / Toolbox / Line intersectionsto create the point where both lines cross.Run
Menu Processing / Toolbox / Network Analysis / Service area (from layer), set the line asnetwork layer, and the point layer with the intersection from step 1 asVector layer with start points, selectshortestforPath type to calculateand forTravel cost (distance for "Shortest", time for "Fastest")set the distance - 25 in your case (see screenshot).This creates a new line (red on the screenshot) of 25 m length along the network (initial line):
Dissolve the resulting line using
Menu Vector / Geoprocessing Tools / Dissolve. Then create start- and end-point for this line usingMenu Processing / Toolbox / Geometry by expressionwith this expression:union(start_point ($geometry),end_point ($geometry))
Variant:
To get several points with varying distance, use the Service area tool in batch mode. To fill in different values for Travel cost, click Autofill... / Add Values by Expression… with an expression like this: array(25,30,50,75) to create points at 25, 30, 50 and 75 m distance:
Using QGIS expressions
This was the initial answer that remains here in case it's useful for similar problems:
Use
Menu Processung / Toolbox / Split with linesto divide your black line in two lines that connect where the red line crosses it.On the splitted line, use Geometry generator or Geometry by expression (see here for details) to create a point on the intersection of both lines plus the points in a distance (along the line) of 25 m from it. When generating actual geometries, use
Menu Vector / Geometry Tools / Multipart to singlepartsto get a separate feature for each point:union ( start_point ( line_substring( $geometry, length ($geometry)-25, length ($geometry) ) ), end_point ( line_substring( $geometry, 0, 25 ) ) )
Screenshot: the expression will generate the points you want plus two additional ones 25 m from the start/end of the line (in the red box) - you can delete them.

To get several points with different distances from the intersection (here: 25 and 30 - adapt this in line 3: you can use as many comma-delimited values as you like), use this expression:
collect_geometries(
array_foreach (
array (25,30),
union (
start_point (
line_substring(
$geometry,
length ($geometry)-25,
length ($geometry)
)
),
end_point (
line_substring(
$geometry,
0,
25
)
)
)
)
)
- 71,072
- 14
- 78
- 208
-
Thanks, what if I need 25, 30 m points north and south? how code will be change? – Fain Jul 05 '21 at 13:53
-
Change 25 to 30 on line 5 and the 4th last line. You could also use an
array_foreachexpression to do it at once. – Babel Jul 05 '21 at 14:00 -
-
1To save the points to a layer, use
Geometry by expressionas explained in the linked post. To create two points in 25 & 30 m distance, use this expression:collect_geometries( array_foreach (array (25,30), [expression_from_above] )). Instead of [expression_from_above], insert the expression from step 2. You can change(25,30): if you want points at 10, 50 and 70 m distance, simply use:(10,50,70). – Babel Jul 05 '21 at 16:16 -
It's working great. unfortunately I am still can't figure out how to insert array_foreach in step 2 code to use 25, 30 in once. – Fain Jul 06 '21 at 12:13
-
1I added the whole expression at the end of the solution. However, I found an easier way - see the added first solution using network/service area. – Babel Jul 06 '21 at 12:49
-
First solution with network analysis is super cool. only wondering how to find points if you one have many cross lines cut main poly line?. The complete solution given in second solution ( using geometry expression still give only points from 25m, not include 30m mark) – Fain Jul 07 '21 at 08:35
-
I don't know what you want to do and how. You want to use all crossing points? Or only some of them? If so: based on what criteria? I guess this is already another question that you should ask separateley by posting a new question. – Babel Jul 07 '21 at 08:37
-
Let me explain like this, A main line is cut by many cross lines at different location. I want to find points from intersection at 25 & 30 m north and south to the intersection. would like to see all points in one layer. – Fain Jul 07 '21 at 08:42
-
OK, that means: 25 & 30 meters distance on the main line from each point where the cross lines intersect? – Babel Jul 07 '21 at 08:48
-


