<div dir="ltr"><div>
Ok cool. When I I try to run the r.stream.distance 
with this new new stream direction layer (that I calculated with 
r.mapcalc "streams_direction_8 = int((streams_direction + 45) / 45)"

),</div><div><br></div><div>it just hangs on the part that says: "caclulating downstream parameters". So I am not sure what is going on here - have you any ideas on this?</div><div><br></div><div>Also, could you explain a little about what this expression is doing: 
(streams_direction + 45) / 45) <br></div><div><br></div><div>Thanks Vaclav<br></div><div><br></div><div><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Le gach dea ghui,<br></div><div><span style="color:rgb(61,133,198)"><b><span style="background-color:rgb(255,255,255)"><i>Shane Carey</i></span></b></span></div><div><span style="color:rgb(61,133,198)"><b><span style="background-color:rgb(255,255,255)"><i>GIS and Data Solutions Consultant</i></span></b></span><br></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 1, 2018 at 4:29 PM Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com">wenzeslaus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">On Sat, Sep 29, 2018 at 1:55 PM Shane Carey <<a href="mailto:careyshan@gmail.com" target="_blank">careyshan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>My last bit of the puzzle is to create the flow direction raster. How do I reclassify in order to get the stream direction using r.mapcalc?</div></div></blockquote><div><br></div><div>Hi Shane,</div><div><br></div><div>You are welcome. What you need to do are 2 steps: 1) vector to raster conversion with direction to be used for raster values:<br><div class="gmail_quote"><br></div><div class="gmail_quote">v.to.rast input=streams output=streams_direction use=dir</div></div><div><br></div><div>The v.to.rast manual says: "line direction in degrees CCW from east" [1]. However, the r.stream.distance manual specifies the drainage direction to be: "...zero and negative values are valid direction data only if they vary
from -8 to 8 (CCW from East in steps of 45 degrees). Flow direction map 
shall be of integer type (CELL)." So you need to reclassify.<br></div><div><br></div><div>[1] <a href="https://grass.osgeo.org/grass74/manuals/v.to.rast.html" target="_blank">https://grass.osgeo.org/grass74/manuals/v.to.rast.html</a></div><div>[2] <a href="https://grass.osgeo.org/grass74/manuals/addons/r.stream.distance.html" target="_blank">https://grass.osgeo.org/grass74/manuals/addons/r.stream.distance.html</a><br></div><div><div><br></div><div>The reclassification with r.mapcalc would be something like the following, but I didn't really check and it may be wrong. Alternative would be to use r.recode.<br></div><div><br></div></div><div>r.mapcalc "streams_direction_8 = int((streams_direction + 45) / 45)"<br></div><div><br></div><div>So please double check the output from the above and compare it with what you get from r.watershed.<br></div><div><br></div><div>For completeness, here is what I wrote before:<br></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">"""<br></div><div class="gmail_quote"><div>Yes, just convert your streams to raster (presence-absence) and a raster for flow direction as I mentioned here:<br></div><div><br></div><div><a href="https://lists.osgeo.org/pipermail/grass-user/2018-September/079135.html" target="_blank">https://lists.osgeo.org/pipermail/grass-user/2018-September/079135.html</a></div></div><div class="gmail_quote"><br><div class="gmail_quote">Since you already have the streams and you want to use them, you need to convert them to raster and then also get <span class="m_8286008131098497242gmail-il">stream</span> direction for <span class="m_8286008131098497242gmail-il">r</span>.<span class="m_8286008131098497242gmail-il">stream</span>.<span class="m_8286008131098497242gmail-il">distance</span> by reclassifying, e.g. with <span class="m_8286008131098497242gmail-il">r</span>.mapcalc, output from something like this:<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">v.to.rast in=streams output=streams_dir use=dir</div><div class="gmail_quote"><br></div><div class="gmail_quote">which you can see in context here (different hydrology tool):<br></div><div class="gmail_quote"><br><a href="http://ncsu-geoforall-lab.github.io/geospatial-modeling-course/grass/simwe.html" target="_blank">http://ncsu-geoforall-lab.github.io/geospatial-modeling-course/grass/simwe.html</a></div><div>"""<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div> I am just coping in what you said from your last email Vaclav so that you know which part I am stuck on. This is really super - thanks again<br></div><div><pre><font size="4">[Since you already have the streams and you want to use them, you need to
convert them to raster and then also get stream direction for
r.stream.distance by reclassifying, e.g. with r.mapcalc]<br></font><br></pre></div><div><div><div dir="ltr" class="m_8286008131098497242gmail-m_7893518257992086789m_5161505017874462402m_-1330632187192361677gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Le gach dea ghui,<br></div><div><span style="color:rgb(61,133,198)"><b><span style="background-color:rgb(255,255,255)"><i>Shane Carey</i></span></b></span></div><div><span style="color:rgb(61,133,198)"><b><span style="background-color:rgb(255,255,255)"><i>GIS and Data Solutions Consultant</i></span></b></span><br></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Sep 28, 2018 at 3:02 PM Vaclav Petras <<a href="mailto:wenzeslaus@gmail.com" target="_blank">wenzeslaus@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Thu, Sep 27, 2018 at 12:10 PM Shane Carey <<a href="mailto:careyshan@gmail.com" target="_blank">careyshan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="auto"></div><div dir="auto"><br></div><div dir="auto">Is there anyway of the algorithm just being able to create a floodlain for actual real rivers as opposed to the derived river dataset? </div></div></blockquote><div><br></div><div>Yes, just convert your streams to raster (presence-absence) and a raster for flow direction as I mentioned here:<br></div><div><br></div><div><a href="https://lists.osgeo.org/pipermail/grass-user/2018-September/079135.html" target="_blank">https://lists.osgeo.org/pipermail/grass-user/2018-September/079135.html</a></div><div><br></div><div>However, you need to be cautious about fit between the existing streams and the DEM. Definitively check how your existing streams align with the derived ones (where there are both streams).<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div class="gmail_quote"><div>On Máirt 25 MFómh 2018 at 15:49, Shane Carey <<a href="mailto:careyshan@gmail.com" target="_blank">careyshan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><div>Image attached shows rivers (black line) and floodplain of where it thinks there are rivers and in some cases where there may not be rivers. <br></div></div></blockquote></div></div></blockquote><div><br></div><div>To use the derived streams and get rid of parts you don't want, you could buffer the existing streams and preserve only the derived streams which are in that buffer.</div><div><br></div><div>However, you should really look at why they are different and specifically what is closer to reality.<br></div></div></div></div>
</blockquote></div>
</blockquote></div></div></div></div></div></div>
</blockquote></div>