This section describes how to get the road density map using a hexagonal grid, along with the road distribution, which will be used for the site survey analysis.
In the OSM layer selected, we need to filter out the Primary, secondary and tertiary roads for analysis.
Import the road layer that we had created before using the process.
We need to filter by the road attributes. Right click ont he road layer and select > “open attribute table”.
In the attribute table, we select the road concerned using the following commands by clicking on the “Select by Expression” menu:


We save the layers as a GeoPackage layer. Right click on the layer with the selection > Save Selected Attributes As. In the window that pops up, select the GeoPackage for the project but save the layer as “Primary Roads”
Repeat all the above steps for “secondary and tertiary” roads.

For the site survey analysis, a plot of road length against fixed distance will be used to visualise road density.
First, we need to merge adjacent road segments together in order to prevent the number of intersections from being overstated. We first go to Vector >Geoprocessing > Dissolve, and in the window that opens, select the OSM road layer as the input layer.

In the reuslting temporary layer, open the dissolved layer’s atribute table, there should only be one row of data.
Following that, we go to the Processing Toolbox on the bottom righthand corner, and search for “Multipart to Singlepart”

In the resulting window, just select the newly dissolved layer and click “Run”.

The final layer that is created, would be soon utilised to create density map. We save the single roads as a new layer in the GeoPackage file.
We can then create a grid. Go to Vector > Research Tools > Create Grid. Fill up the attributes as according to the below image. Make sure distance is set to 5000m, and then the shape type should be a hexagon.

Each cell of the grid is a unit in which the density of the road network there will be calculated, with the measure of the density being length / 5x5km hexagonal area.
we also need to clip the grid to the study area. Go to Vector > Geoprocessing Tools > Clip on the top bar and select the input layer as the temporary grid layer an the bottom layer as the study area layer as defined before, following the screenshot and then click run.




Now, the road density map is complete.