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.
1 Answer
Create a polygon grid using the Vector Grid
tool instead of lines. Make sure to check the polygon output.
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
Here's a simple example of a vector polygon grid with overlayed line layer.
And after the sum lines in polygons tool, with symbology based on the summed length field.
-
If I create a vector grid, what do parameters stand for? I guess they represent geometric resolution, but which scale units are used? I used 0,01 and in utm32 edge length seems to be 692 meters?– RevoMay 1, 2016 at 16:51
-
1The grid size is dependent on your layer CRS. If you used 0.01 degrees in a geographic system like WGS, then that result fits the 692 meters you measure when projected to UTM. I used a metric CRS, and defined the grid size to be 100 meters in my example. Again, it all depend on your CRS and the spatial resolution you need.– HDunnMay 2, 2016 at 12:19