[GIS] Sum line lengths for each grid cell in QGIS

grids-graticulesqgisspatial-joinvector-grid

I'm trying to get data from a polyline layer into a grid (I've created this with regular points, points to polylines). I guess at first I have to cut all polyline segments at the grid lines and then I have to spatially join (which only works for the first feature found) all of them into each grid cell. I want to find out road network length differences in different areas.

enter image description here

Best Answer

Create a polygon grid using the Vector Grid tool instead of lines. Make sure to check the polygon output.

enter image description here

Once you have a polygon grid (also known as fishnet), you can use the Sum line length tool in the QGIS Vector analysis tools. This will result in a new field for each cell with the total road length inside it

enter image description here

Here's a simple example of a vector polygon grid with overlayed line layer.

enter image description here

And after the sum lines in polygons tool, with symbology based on the summed length field.

enter image description here

Related Question