I am trying to use a combination of r.walk and r.drain in the QGIS grass plugin to model the most efficient path between two points, where cost is accumulated principally by movement over deeper water. Ultimately I want to measure the A-B distance whilst sticking within the depth range of the species I am modelling.

I have created a reclassified raster using r.walk, which is coded in 20 equal steps according to cumulative cost travelling from the point in the South West Atlantic. Reclassified raster with cumulative cost of travel from the red starting point

I then use the r.drain tool to calculate the most efficient route from the red starting point to a finishing point just east of the British Isle for arguments sake. The output is a raster file which I am then attempting to convert to a vector using r.to.vect.line, but this process appears to freeze and I am forced to cancel it. There is no explanation given and so I have no idea why the process is freezing or otherwise not working. Can anyone offer a suggestion?

Raster resulting from r.drain

  • Try doing it outside qgis. When Qgis is installed Grass is also installed. You can try using the Grass GUI in order to achieve waht you want. Commented Feb 27, 2016 at 12:17

1 Answer 1


I have found the solution and it is staggeringly simple - I just inverted the colours on the route raster layer, so that a black line appeared on a white background. I am not sure why this worked but my guess is that the r.to.vect.line interprets black as the line it is supposed to vectorise, and so was crashing in an attempt to make a vector line out of a black background. That is my guess but if anyone can add any clarity please feel free.

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.