Skip to main content
1 of 4
Babel
  • 74.9k
  • 15
  • 87
  • 227

How to calculate angles with QGIS - interior angles of polygons or lines

The problem

In QGIS, it's easy to calculate areas of polygons or lengths of lines using QGIS expressions with area ($geometry) / $area or length($geoemtry) / $length respectively. However, there is no expression to measure angles based on the three points that define it.

The question

Given a polygon of any shape in QGIS, how can interior angle be measured apart from the manual measuring tool (toolbar icon)?

What I tried

What sounds quite easy at the first glance is more complicated. QGIS expressions offer a few angle-functions as:

  • line_interpolate_angle
  • angle_at_vertex
  • main_angle
  • azimuth

However, there is no get_angle_at_vertex(geometry,index) function so that you could calculate the angle of any polygon- or line-geometry at a certain vertex and neither an angle (point1,point2, point3) function.

Babel
  • 74.9k
  • 15
  • 87
  • 227