1

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.

Before After

Babel
  • 71,072
  • 14
  • 78
  • 208
  • If I understood your question correctly, you can do this using Geometry generator - like: make one line, but show 3 lines – Babel Aug 25 '22 at 15:23
  • can I edit each line by vertex tool ? – Hassan Sami Aug 25 '22 at 15:43
  • No, you can only edit the initial line. If using geometry generator, the lines you generate are not actual geometries, just styles for visualization. But you can use geometry by expression to make from one lione 3 lines, where you can use vertex tool on all 3 lines - see: https://gis.stackexchange.com/a/392619/88814 You can use QGIS expressions, e.g. translate(), see https://docs.qgis.org/3.22/en/docs/user_manual/expressions/functions_list.html#translate – Babel Aug 25 '22 at 15:56

1 Answers1

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: enter image description here

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