I'm using QGIS 3.22 and I need to make a layer called 3line it's contains 3 categorize and there's color for each categorize, when I copy single line from different layer and past it in my 3line layer it's automatically converted to 3 line (line beside line), attached screenshot shown the result that I mean.
Asked
Active
Viewed 48 times
1
Babel
- 71,072
- 14
- 78
- 208
Hassan Sami
- 11
- 2
1 Answers
1
You can use QGIS expressions to create additional lines from one single line. Basically, there are two options (see here for details):
- Geometry generator: this creates new lines as style, for visualization only. You can't edit these lines, they "depend" on the initial line: when editing the initial line, the two added lines change as well
- Geometry by expression: creates actual lines (geometries) where you can edit vertices etc.
The expression is the same in both cases. If you have a line and want to create two parallel lines on both sides with distance 10 (change this value to fit your needs), use this expression:
collect_geometries (
array_foreach (
array(-1, 1), -- add further, comma-delimited values to create more lines
offset_curve( $geometry, @element * 10) -- change offset distance here
)
)
Variant using Geometry generator: red=initial line; black=lines created with the expression:

Line 3 (array(-1,1)) defines the number of lines to create: here two lines, negative value on the right side, positive values on the left side. The value here is multiplied with the offset-distance in line 4 (here: 10).
Babel
- 71,072
- 14
- 78
- 208


translate(), see https://docs.qgis.org/3.22/en/docs/user_manual/expressions/functions_list.html#translate – Babel Aug 25 '22 at 15:56