<html style="direction: ltr;">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body bidimailui-charset-is-forced="true" style="direction: ltr;"
    text="#000000" bgcolor="#FFFFFF">
    <p>Here's an idea, using GRASS, that might get you started.</p>
    <p><br>
    </p>
    <p>First use the v.drape module to convert your river network to a
      3D grass vector. Now add X,Y,Z coordinates to all start and end
      points for all river sections with v.to.db. With that you can
      extract those river sections where the Z value of the endpoint is
      greater than the Z of the start point. Finally, with v.edit, slip
      only those river sections.</p>
    <p><br>
    </p>
    <p>Putting it all together. This is untested, use at your own risk
      :-)</p>
    <p><br>
    </p>
    <p>v.in.ogr input=rivers.shp output=rivers</p>
    <p>r.in.gdal input=srtm.tif output=srtm</p>
    <p>g.region -ap vect=rivers res=30 # Assuming the SRTM is 1 arcsec,
      or 30 m resolution</p>
    <p><br>
    </p>
    <p># Make 3D rivers vector<br>
    </p>
    <p>v.drape input=rivers output=rivers_3d elev=srtm</p>
    <p><br>
    </p>
    <p># Add X,Y,Z for start and end points<br>
    </p>
    <p>v.db.addcolumn map=rivers_3d columns="start_x DOUBLE, start_y
      DOUBLE start_z DOUBLE, end_x DOUBLE end_y DOUBLE end_z DOUBLE"</p>
    <p>v.to.db map=rivers_3d option=start
      columns="start_x,start_y,start_z"</p>
    <p>v.to.db map=rivers_3d option=end columns="end_x,end_y,end_z"</p>
    <p><br>
    </p>
    <p># Flip only those river sections that are in wrong direction</p>
    <p># Add the "snap" tool along the way to make sure line segments
      are indeed connected<br>
    </p>
    <p>v.edit rivers_3d tool=flip,snap where="end_z>start_z"
      thresh=10<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 13/04/2019 23:31, Nicolas Cadieux
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:718dfc82-b3b9-a816-cea1-ea2e3e8dd9ee@archeotec.ca">Hi,
      <br>
      <br>
      I have a difficult problem.  I have a very large river network
      file made with a 2D shapefile.  (I have the SRTMs for the same
      region).  I would like to model a river network but I need to keep
      in mind the river flow direction.  Unfortunately, I think this
      file was manually digitized and therefore, line directions have no
      relationship with river flow direction.
      <br>
      <br>
      Can anyone suggest a way to use my SRTMs to change the line
      directions or to add a flow direction variable without resorting
      to manually editing the layer?
      <br>
      <br>
      Thanks,
      <br>
      <br>
      Nicolas
      <br>
      <br>
      _______________________________________________
      <br>
      Qgis-user mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
      <br>
      List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
      <br>
      Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
  </body>
</html>