# Angle from x axis with QGIS

I am using QGIS 3.10. I am trying to make an angle of line from x-axis in 0-180 range. This picture shows what I'm trying to do. I want green lines to have angle of 140 for the upper one and -52 for the lower one. There is some solutions like this:

``````(atan((xat(-1)-xat(0))/(yat(-1)-yat(0)))) * 180/3.14159 + (180 *(((yat(-1)-yat(0)) < 0) + (((xat(-1)-xat(0)) < 0 AND (yat(-1) - yat(0)) >0)*2)))
``````

But this code starts measuring from North in clockwise direction but this does not work for me.

Is there any solution??

For example when I create a line I want in attribute list angle of that line starts from 0. Angle of new line should be 40 The best thing to do in my opinion is have a specific code in field calculator.

• Your question has no accepted answer and I guess that's because your question is still not clear. If you're still looking for an answer, please be more precise and explain what exactly you want to do. Aug 13 at 8:48

I am not sure if I understand correctly but with the advanced digitizing panel you should be able to create different angles. You can digitize lines a specific angle or lock lines to specific angles. 