I have two vector line datasets and wish to compare the line lengths. While I have already compared the sum of the lengths, I'd like to conduct further analysis down to 250m, possibly lower.

I'm using qGIS, and already know how to create a vector grid. However I would like to create a grid which clips per individual square and compares the length of the two datasets contained within.

I realise that this is a process that could be completed manually, however the size and complexity of the data (all roads at a city level) mean manually doing the task would take months.

1 Answer 1


One way is to use the Vector|Geoprocessing|Intersect tool in QGIS and a spreadsheet (LibreOffice/Excel).

  1. Create a polygon grid which you'll use to chop up the two line datasets – either the vector grid tool you used before (but doing a polygon output) or whatever grid you need (city blocks?). Let's call this "G".
  2. Intersect each of the line datasets - call them A and B - with the grid and call your output shapefiles something like AG and BG. The "input vector layer" in the dialog should be the line layer each time, and the "intersect layer" is the polygon. The resulting shapefile will be the line layers chopped up by the boundaries between polygons, and the attribute table will combine the ID (and other attributes) of the polygon layer.
  3. Calculate the new, chopped-up line lengths for AG and BG (Field Calculator using $length).
  4. Open the attribute tables for AG/BG in Libreoffice and do a pivottable summarising total length for the polygon ID (probably ID_2 after the intersection operation). You can then combine the pivottables by ID_2 and compare total lengths for each of the line datasets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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