[GRASS-user] bash scrip r.cost/r.drain

Hello all.

I was wondering if anyone has a bash script that runs over all pairs of points in a vector file, using them each in turn as start_coordinate in r.cost, and as a final point in r.drain. Thank you. Or, something similar that I could easily modify to my purposes.

Anders.

On Mon, 30 Aug 2010 20:38:40 +1000
Anders Gonçalves da Silva <andersgs@gmail.com> wrote:

Hello all.

I was wondering if anyone has a bash script that runs over all pairs
of points in a vector file, using them each in turn as
start_coordinate in r.cost, and as a final point in r.drain. Thank
you. Or, something similar that I could easily modify to my purposes.

You could probably start by throwing the points into a text file with
v.out.ascii, then loop thru that file with something like:

v.out.ascii <vector> out=ascii_vector_points.txt fs=space
while read X Y ;
  do <your r.cost command coord=$X,$Y>;
done < ascii_vector_points.txt

Anders._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.

Hi Micha.

Thank you very much. That worked like a charm. With that initial kick, I was able to create a little loop that goes through each point in my dataset, and outputs a column matrix with pairwise distances for each observation. Now, I just need to add more friction rasters.

Cheers,

Anders.

On 31/08/2010, at 12:32 AM, Micha Silver wrote:

On Mon, 30 Aug 2010 20:38:40 +1000
Anders Gonçalves da Silva <andersgs@gmail.com> wrote:

Hello all.

I was wondering if anyone has a bash script that runs over all pairs
of points in a vector file, using them each in turn as
start_coordinate in r.cost, and as a final point in r.drain. Thank
you. Or, something similar that I could easily modify to my purposes.

You could probably start by throwing the points into a text file with
v.out.ascii, then loop thru that file with something like:

v.out.ascii <vector> out=ascii_vector_points.txt fs=space
while read X Y ;
  do <your r.cost command coord=$X,$Y>;
done < ascii_vector_points.txt

Anders._______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.