QGIS – Calculating Longest Flow Path from Single Feature Vector

flowlengthlineqgis

I have got a vector layer with one feature (MultiLineString) representing a river network (s. below) without bifurcations. In addition there is a point shapefile containing the outlets of different subcatchments and one polygon for each of them.

Example: in the following image, the length should be from A (outlet, point in shapefile) to B (should be found automatically). As the point at A is not exactly on the line, an ideal solution would replace the outlet onto the line.

Drainage network and catchment outlets

Is there a simple way to calculate the longest flow path (one single branch) in QGIS? The final goal is to have one length for each subcatchment.

Best Answer

There is a tool in Whitebox Geospatial Analysis Tools called Vector Stream Network Analysis within the Stream Network Analysis toolbox. It will take a shapefile stream network, that does not contain topological information about flow direction among stream links, and a coarse resolution DEM as inputs. It will output a number of stream metrics for each stream link in the attribute table including:

enter image description here

Extracting each link containing 'true' for the MAINSTREAM attribute, will isolate your longest path in each network. Here's an example of the Grand River network in Ontario:

enter image description here

The tool isn't well documented because I am still in the process of publishing the paper related to the tool.

Related Question