As shown in the image I have a road network and the intersections as separate layers on QGIS. What I require is to extract the Minimum Spanning Tree connecting all points along the road network. Would be grateful for any suggestions as to how I may go about doing this.

The data that I currently have on QGIS


There is an already existing tool in processing plugin in GRASS -> Vector -> v.net.spanningtree

enter image description here

You will need to specify the vector line layer and the nodes ( optional ) and in advanced parameters add the type of the geometry of the output layer

and that's it, you'll get a new vector layer with the spanning tree

enter image description here

  • 1
    Thank you very much for the answer. However when I run the tool I get the following error "Wrong or missing parameter value: v.out.ogr output type". Not quite sure about the reason behind it. – Nandula Jul 17 '19 at 9:14
  • 2
    in advanced options, add the type of the output layer ( line ) – Hicham Zouarhi Jul 17 '19 at 9:47
  • When I try this I end up with ERROR: North must be larger than South followed by a number of Vector map <> not found error messages. – Nandula Jul 18 '19 at 10:28
  • @Nandula that's a bug in previous versions of GRASS it has been fixed in the last version of qgis 3.8, check here github.com/qgis/QGIS/pull/8557 – Hicham Zouarhi Jul 18 '19 at 11:54
  • When using the data I extracted using the OSMnx library to run v.net.spanning tree the following error is displayed: ERROR: Unable to create table: 'create table vector_5d367815ccab93 (cat integer, id integer, access varchar ( 80 ), bridge varchar ( 80 ), from varchar ( 80 ), highway varchar ( 80 ), junction varchar ( 80 ), key varchar ( 80 ), lanes varchar ( 80 ), length varchar ( 80 ), maxspeed varchar ( 80 ), name varchar ( 83 ), oneway varchar ( 80 ), osmid varchar ( 80 ), ref varchar ( 80 ), to varchar ( 80 ), tunnel varchar ( 80 ), width varchar ( 80 ), source integer, target integer)' – Nandula Jul 23 '19 at 3:01

You may also rely on the 'Minimum Spanning Tree' plugin of QGIS 3.x.

The paper Geo-MST: A geographical minimum spanning tree plugin for QGIS discusses the plugin thoroughly.

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.