4

I'm working with QGIS 3.16 Hannover. I have a point layer and I want to create a new line layer with features derived from the first one, using the following code

make_line(
 -- using an array of points placed around the original
array_foreach(
-- list of angles for placing the projected points (every 90°)
array:=generate_series( 0, 360, 90 ),
-- translate the point 20 units in the given direction (angle)
expression:=project( $geometry, distance:=20, azimuth:=radians( @element ) )
 )
)

How can it be done?

0

1 Answer 1

5

Simply add a new symbol layer / Geometry Generator / Linestring and paste your expression. This is for visualization only. To get actual geoemtries, use Geometry by expression (see here for the differences).

enter image description here

1
  • That "Geometry by expression" is what I needed and it was simply in the toolbox.
    – jpinilla
    Commented Oct 12, 2021 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.