QGIS Polyline – Create and Rotate a Straight Line from a Point with Specific Length in QGIS

geometry-conversionpointpolyline-creationqgisrotate

I want to create a straight line that starts from the point with the given length. And also it rotates around the point.

I have a point data of cctvs:

point data of cctv

And I want to create a line with the given length of 50 meters on each point that rotates at 5 degrees.

To help understand the result would be like this picture for each point.

rotate line

Best Answer

You can use Geometry by expression.

This will create a point projected from the center point in the directions 0, 5, 10, 15, ..., 355
at 50 m distance, then draw a line from the center point and the projected point:

collect_geometries( 
array_foreach(array:=generate_series( 0, 355, 5),
expression:= 
 make_line($geometry,  
 project( point:=$geometry, distance:=50, azimuth:=radians(@element)
 ))))

enter image description here

It will be a multiline, you can explode it to singlepart lines with Multipart to singleparts

Related Question