<div dir="ltr">Hi Tom,<div><br></div><div>what comes into my mind is following approach (not tested):</div><div><br></div><div>1) calculate flow direction using r.watershed for each pixel of your map</div><div>2) transforming raster to vector points (r.to.vect), adding some columns for your results (X, Y, ID). This step should provide you already with unique IDs for your cells/points.</div><div>3) With v.to.db you can update the X  and Y coordinate of your cell center and together with the raster resolution you can get the lower left corner as desired.</div><div>3) By knowing the flow direction for each point you should be able to calculate the X and Y coordinate of the downstream cell (adding or substracting your cell dimensions from the cell center, correct for diagonal flow). When you know X and Y of your downstream cell then you should be able to also get the ID of the downstream cell (most probably a SQL query I guess)</div><div><br></div><div>Maybe there are easier ways....</div><div><br></div><div>hope it works,</div><div>Johannes</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 12, 2014 at 5:10 AM, Thomas Adams <span dir="ltr"><<a href="mailto:tea3rd@gmail.com" target="_blank">tea3rd@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">All:<br clear="all"><div><br></div><div>I need to generate an ascii text file from a flow direction grid that consists of (among a couple other things that don't really matter at this point) for each pixel:<br><br></div><div>(1) a unique integer identifier (1 -- N) for the pixel<br></div><div>(2) the integer identifier of the downstream pixel (assuming there is ONLY one)<br></div><div>(3) the x,y location of the pixel (presumably, the lower left corner of the pixel)<br><br></div><div>has anyone already done something like this?<br><br></div><div>It's needed (along with some header information) as an input file for a gridded distributed hydrologic model, identifying the flow connectivity from pixel to pixel for streamflow routing purposes. I have already formulated conceptually how to do this, but if someone has already done such a thing, why reinvent the wheel??<br><br></div><div>Any help is appreciated.<br><br></div><div>Regards,<br></div><div>Tom<br></div><div><br></div></div>
<br>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></div><br></div>