I am trying to calculate the optimal route from one archaeological site to multiple sites. I already have the r.cost raster. My question is if I can use r.drain to multiple destination points.

  • Doesn't "optimal route" imply to get a single result? Or do you want to visit all sites one after the other? Then it might be seen moreover as network problem, hence "travelling salesman" (grass.osgeo.org/grass70/manuals/v.net.salesman.html) on a vector graph. – markusN Oct 24 '15 at 11:44
  • not necessarily, if you look at the dialog box of r.drain it literally say "map coordinate of starting point(s) (E,N). Moreover if you look at the help it also says "The coordinate parameter consists of map E and N grid coordinates of a starting point. Each x,y pair is the easting and northing (respectively) of a starting point from which a least-cost corridor will be developed. The vector_points parameter can take multiple vector maps containing additional starting points. Up to 1024 starting points can be input from a combination of the coordinate and vector_points parameters." – Gerardo Jimenez Oct 26 '15 at 14:03
  • Nevertheless I have not found how to put the coordinates of multiple points. What I want is an individual route from the "center" to each one of my sites and that the route calculated takes in to account movement impediments, like topography, for instance – Gerardo Jimenez Oct 26 '15 at 14:05
  • By the way the tool you are porposing is for vector layers, I wonder if it can it take in to account an anistropic surface. – Gerardo Jimenez Oct 26 '15 at 17:37
  • What's wrong with 'start_points' parameter in GRASS 7 (vector_points in GRASS 6.4)? – Anna Oct 27 '15 at 4:14

The GRASS GIS 6.4 r.drain manual page shows:

coordinate=x,y[,x,y,...] Map coordinates of starting point(s) (E,N)

so just enter your coordinates as:

r.drain coordinate=x1,y1,x2,y2,x3,y3 ...

or you can save the coordinates as a vector and use parameter vector_points. These parameters are renamed in GRASS 7, check the manual.

  • The way you describe works perfectly. I already check the manual, even quote it, but I did not notice anything specific about my question. – Gerardo Jimenez Nov 2 '15 at 23:18

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.