# Can the arrows produced by the d.rast.arrow GRASS script be queried or stored?

I have created a map with the flow directions using the d.rast.arrow. Can i query on the map to know where the direction of the arrows are? I am going to use the arrow directions in an algorithm. Or, is there a way to store the arrow directions in a text file so that I can import it in my code? Thanks!

The arrows directions are the Z value in the aspect map. The display (d.####) commands like d.rast.arrows only output to the display. You can export the aspect map as a text file, so you will have a file with coordinates and directiction of the flow.

• The file that I exported using the r.out.xyz. Here is a sample row: "120.902916666667|14.99875|17.9524154663". Are all the values that are stored in the text file all values that are not null? – teamAngat Feb 15 '11 at 15:31
• What? I didn't understand. – Pablo Feb 15 '11 at 16:02
• Are the values stored in the text file generated by r.out.xyz all the values of the map that are not null? – teamAngat Feb 17 '11 at 15:37
• Oh, yes, they are. As the manual say "This module will not export x,y coordinates for raster cells containing a NULL value". – Pablo Feb 17 '11 at 16:56

Why don't you just run your algorithm directly on the map you used to create the arrows? If it's an aspect map, it will already contain the direction in degrees counter-clockwise from east.

You can save the aspect map to a text file using r.out.ascii, e.g.

r.out.ascii input=aspectMap output=aspect.txt dp=2 null=*

where dp is the number of significant digits, and null is the character to be used in the ascii file when a value is not defined.

Depending on how you're implementing your algorithm, you can also do the calculations directly in GRASS using r.mapcalc. For example, to create a map that has the value 1 for all pixels with a north western aspect and 0 for all others, use