# The average distance between the roads

I have two vector layers.

I want somehow to get the average value of the distance between each roads and get average value for my region. Each road has its own ID. Is it possible to get it automatically, vector or raster results? I use QGIS and ArcGIS, any solution will be OK. This is manually connected.

• Can you elaborate on the desired end result? Why does the solution by @mixedbredie not meet your needs for "calculat[ing] the density of the road network?" – Map Man Aug 29 '17 at 13:55
• "I want somehow to get the average value of the distance between the roads. In fact I need to calculate the density of the road network" - that sounds like two separate and totally different questions. Clarify? – Spacedman Aug 29 '17 at 16:34
• For one region I want to show how much the average distance for all roads with one value in meters. After that, I propose where the network of roads is to be thicker and reduce the average distance. For city roads this is not relevant but for roads outside the city, this information may be important – nagib Aug 29 '17 at 17:31

To calculate the road density per unit area you could overlay a grid and then sum length per cell.

In QGIS there is an analysis tool called Sum Line Length which does exactly this. This would ignore the point layer though.

The grid can then be styled using either the count or summed length fields as a measure of the density.

• I need the distance between the roads and not the road density on the surface. See figure 2. – nagib Aug 29 '17 at 11:46
• How do you assign pairs of points? Could you just use the points layer and do a nearest neighbour analysis grouping by cell - where mean distance is lower roads are closer together? – mixedbredie Aug 29 '17 at 11:54
• Link points, it can also, but how – nagib Aug 29 '17 at 12:02
• not easily - this might help gis.stackexchange.com/questions/160574/… – mixedbredie Aug 29 '17 at 12:31
• Maybe a model with some iterative form of Near Analysis, where each point in the road finds the nearest point of the adjacent road? The difficult part would be the selection process to ensure that you are selecting the adjacent road... – Map Man Aug 29 '17 at 13:53

I would suggest using raster analysis for this problem. Converting the road network to a raster and performing proximity analysis (using Arc or QGIS) should result in a raster of continuous values representing distance from the nearest road: Next, we create a polygon shapefile of the area contained within the streets. And lastly, utilizing Zonal Statistics in QGIS, add fields to the polygons shapefile with the Mean/Min/Max values from your Proximity Raster:

• "For one region I want to show how much the average distance for all roads with one value in meters. After that, I propose where the network of roads is to be thicker and reduce the average distance. For city roads this is not relevant but for roads outside the city, this information may be important " In this case then - you might want to extract the ridge line from a proximity raster - that would be the line equidistant from two roads. SAGA (within the Processing Toolbox of QGIS) has a "Valley and Ridge Detection" tool which would pull these out for you. – user2675869 Aug 29 '17 at 20:12
• I do not have this SAGA tool. I use QGIS 2.18. And SAGA 2.3.2 (249 geoalgorithms) – nagib Aug 30 '17 at 6:26
• At least QGIS 2.18.12 (Win10 64-bit) got 364 geoalgorithms in the SAGA-toolbox. Geostatistics > Zonal raster statistics – Nightwatch Aug 30 '17 at 13:36