<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">
    <br>
    <div class="moz-cite-prefix">On 14/04/2019 14:11, Nicolas Cadieux
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:DA621C9C-2AF0-4375-81F3-16EC14FD079C@archeotec.ca">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Micha,</div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr">Great ideas, thanks.  I was trying to get the
        v.drape to work in Qgis but I was getting errors.  I figure it’s
        bad topology.  I will fix it and try again directly in Grass. I
        did manage to get the end nodes and start nodes.  That has not
        easy as the vectorizing was done in very small sections.  I was
        surprised to see so little merging tools that could</div>
    </blockquote>
    <p><br>
    </p>
    <p>You might want to simplify the rivers first. (v.generalize)</p>
    <p> <br>
    </p>
    <blockquote type="cite"
      cite="mid:DA621C9C-2AF0-4375-81F3-16EC14FD079C@archeotec.ca">
      <div dir="ltr"> deal with this without manually selecting the
        lines.  I tried with an old Qgis 2.18 plugin but it was not
        working properly.</div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr">Your work flow is similar than what I had in mind
        but the detail you gave will most certainly be useful.</div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr">Nicolas</div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr"><br>
        Le 14 avr. 2019 à 02:24, Micha Silver <<a
          href="mailto:tsvibar@gmail.com" moz-do-not-send="true">tsvibar@gmail.com</a>>
        a écrit :<br>
        <br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">
          <meta http-equiv="Content-Type" content="text/html;
            charset=UTF-8">
          <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"
              moz-do-not-send="true">Qgis-user@lists.osgeo.org</a> <br>
            List info: <a class="moz-txt-link-freetext"
              href="https://lists.osgeo.org/mailman/listinfo/qgis-user"
              moz-do-not-send="true">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"
              moz-do-not-send="true">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>
        </div>
      </blockquote>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918</pre>
  </body>
</html>