2

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

8

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

  • 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? – Revo May 1 '16 at 16:51
  • 1
    The 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. – HDunn May 2 '16 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.