I have a vector layer of polylines with a set of multiple lines having length and bearing (azimuth in plane). I need to make some statistics on these lines, including the construction of rose diagrams over directions (with adjustable step on angles) and histogram of lines length distribution. How it is possible to achieve this in QGIS?

  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq.
    – underdark
    Dec 17, 2016 at 17:16

2 Answers 2


There is a plugin Line direction histogram that can do what you want of creating rose diagram. Based on the description of the plugin, it says:

The plugin visualises the distribution of line segment directions as a rose diagram (weighted using the line segment lengths). Can save the rose diagram as CSV, PDF or SVG.

I have not test it, but it can give you some support to achieve the task. You can also find some help from the documentation of the plugin.


How important is it for you to do all of it within QGIS?

If you are willing to do some processing out of QGIS, then you may be interested to note that if you copy an object in QGIS, and paste it in another appli -- say a text editor or excel -- you will automatically get the coordinates pasted in your text file (in WKT format), like that :

wkt_geom    id  LPlunge Ref
LineString (30.56316221314751758 -25.99575791939152936, 30.56831877480769322 -25.99784841736186891)         Kisters et al. 2010

This is a 2-points polyline I just copied from one of my loaded shp layers, and pasted in the edit box here.

Based on this, it is straightforwards to split you input within excel (in that case use the text import wizard and define space and brackets as field delimiters) and then do the processing. In my spreadsheet I have x1, y1, x2, y2 as columns A to D; DeltaX and DeltaY as G and H, i.e.

DeltaX (G2) = C2-A2

DeltaY (H2) = D2-B2

Thus length = sqrt(G2*G2+H2*H2)

trig_angle (I2) = ATAN(H2/G2)*180/PI()

azimuth = IF(G2>0;90-I2;270-I2)

And voilà ! You get an excel table of length and azimuths (and all the other properties that were in the shapefile to start with), that you can then process with you usual rose diagram software (stereonet ?).

Having the formula, by the way, suggests that a couple of lines in Python would probably do the trick but I'll leeave that to the Ctrl+Alt+P gurus...

This assumes, by the way, that you are using a CRS where the North is actually aligned with the y-axis (so no UTM !), and probably also one where the x-size of units = y-size (so no plate carrée, EPSG:4326 !). The plugin mentionned above may well suffer from the same limitation.

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.