Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.
share|improve this answer
+1 for getting the best out of spreadsheets! – vinayan Apr 15 '12 at 2:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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