The QGIS Line Direction Histogram Plugin creates a rose diagram that can be used to investigate the distribution of the directions of line segments of a line or polygon vector dataset.
The accumulated lengths of the line segments for each direction bin determines the shape of the histogram. Alternatively, the number of segments can be used (no weighting on line segment length).
Line and Polygon vector layers are supported, including multigeometries.
Feature selections are supported.
The number of direction bins for the histogram can be specified.
Fewer bins | More bins |
---|---|
![]() |
![]() |
All the direction bin sectors will have the same size (same number of degrees covered). This type of angle histogram is also called a “rose diagram” or “rose plot”.
An angle offset (positive or negative - clockwise or counter clockwise) for the direction bins can be specified.
The positions of the direction bins are shown graphically.
Direction bins illustration and options |
---|
![]() |
The user can choose if the histograms shall be “orientation” neutral (0-180 degrees instead of 0-360 degrees).
Orientation neutral | Not orientation neutral (with twice the number of bins) |
---|---|
![]() |
![]() |
Added in version 2.0.
There is an option available for producing at point layer styled using rose diagrams (using SVG files) according to a tiling specified using a polygon layer.
All the other options are also respected when generating the rose diagrams for the tiles.
Due to a QGIS issue with SVG file caching (#13565: “modifying a svg already cached doesn’t invalidate the cache, renders as version initially loaded during a session”), the SVG files have to be stored using unique file names. This produces a lot of SVG files that are not deleted by the plugin.
Added in version 2.4.
An indication of the direction mean (direction and strength) can be added to the rose diagrams.
Direction mean | |||
---|---|---|---|
Not or. neutral | Orientation neutral | ||
medium | low | high | |
![]() |
![]() |
![]() |
![]() |
The displayed histogram is normalised, so that the maximum value of the direction bins will result in a sector with a maximum length, and the lengths of the sectors of the rest of the bins are scaled proportionally.
The saved histogram is a CSV file with four columns:
”.” is used as the decimal separator in the CSV file.
The CSV file is accompanied by a CSVT file that describes the data types of the CSV file columns.
The user can specify if only selected features are to be used (but if no features are selected, all features will be used). This is the default if the layer has selected features.
The user can specify the number of direction bins (the default is 8).
The user can specify an angle offset (clockwise from north) for the direction bins (the default i 0).
The user can choose to ignore the “orientation” of the lines. In that case, two lines with opposite directions will end up in the same direction bin (this is the default).
The user can specify an output CSV file for the (over all) histogram.
The user can specify if line segment length shall be used for weighting the bins (this is the default).
The user can choose to use the logarithm to define the radius of the sectors. The default is not to use the logarithm.
The user can choose to have the area of a sector of the histogram be proportional to the accumulated amount for that sector. The default is that the length / radius of a sector is proportional to the accumulated amount (histogram like behaviour).
The user can choose to produce a point layer styled with rose diagrams according to a tiling by a selected polygon layer. For this option, it is also possible to specify the location for storing the generated SVGs (that are used for styling the rose diagram layer.
The user can specify that the direction mean shall be included in the rose diagram(s).
For the orientated option, a line that shows the average direction vector is added.
For the non-orientated option, the sector that has the highest mean direction value is given a background colour, with the amount of colour indicating the strength of direction trend (white for neutral, 100% colour if all line segments have a direction that belongs to this sector). For the non-oriented option, the sector bins are transparent.
The calculations of the histogram is performed in a separate thread. Each line geometry is traversed from start to end. For each segment of the line, the angle and length are calculated. The angle is used to determine which bin the segment falls into, and the length is added to the accumulated length for the bin.
Polygons are split into its rings, and the line geometry of each ring is used for the calculations.
The normalised mean direction vector (dist_mean) is calculated using vector summation from the bins (sectors). Each sector is represented by a vector (sector) with length equal to the total length of the line segments in the sector. The middle of the bin’s sector is used as the angle for the sector vector. The result vector is normalised by dividing by the sum of the bin / sector line lengths.
The mean direction is found by calculating the magnitude of the “direction trend” for each of the bins.
The “direction trend” for a bin, B, is calculated using the values for all the bins within 90 degrees offset from the angle of B. For each bin (including B), the angle between that bin and B is calculated (using the angles of the middle of the bin sectors), and the cosine of that angle is multiplied by the bin value.
The “direction trend” of B is the sum of these values. The bin with the largest value is taken to represent the direction mean.
The value is then normalised to a [0..1] scale using the the sum of the bin values (total_sum) as the maximum value, and the value that had been obtained (even_dist_value) if the distribution of line segment lengths among the bins had been even, as the minimum value.
The current version is 2.5.1
1.0: First official version.