[GIS] Calculating the length of the network lines inside polygon in QGIS 2.10.1

lengthlinepolygonqgisqgis-2.10

I am working with 2 datasets:

  • delineations of the neighbourhoods
  • traffic network.

This is how they look:

enter image description here

I would like to calculate the length of the roads per neighbourhood (polygon). As you may expect some of the roads are in more than one neighbourhood so what I have to do first is "cutting" them at point where they are crossing with polygon boundaries. I have tried to use intersect tool but it did not work. I always got empty file as an output. The projection I am using is RD New (for both files) so it should work. Any ideas how can I achieve my goal?

When I have roads cut I would calculate the length of every line and afterwards sum these lengths up per neighbourhood. Is it a good way to do it?

Best Answer

Give the Sum Line Lengths tool a try, from the Vector > Analysis Tools menu:

enter image description here

This will create a new shapefile that summarizes each input polygon vector layer feature by the length of input line vector layer.

The output shapefile should have an attribute field called LENGTH as you can see in the above screenshot, but you can change that to SUM_LENGTH or something similar.

Then you can visualize your map on that field, if that is your purpose:

enter image description here

NOTE the units are important to your inputs, so in my example decimal degrees are not too meaningful...but if your input coordinate system is in metres you should be good.

Related Question