3

I am trying to define the direction of my polylines (which represent gutters in a drainage system). Does anyone know if it is possible to define the direction based on elevation data extracted from a DEM? I would like my polylines to be oriented such that they begin at the upstream point and end at the downstream point. I know you can use the "flip" gp tool to change the polyline direction, but this is tedious/impossible to do for a large data set.

3
  • Are all polylines in your network flowing in sea to source direction or is it a mixture, some pointing upstream and some pointing in the correct downstream direction?
    – Hornbydd
    Jan 5, 2016 at 23:31
  • 1
    Are you open to python scripting?
    – Barbarossa
    Jan 5, 2016 at 23:44
  • How I have done this previously is to get the end points (FNode and TNode), extract the surface Z using either 3d analyst or other means then joining by the FNode and TNode to the points... then select FNode::Z < TNode::Z and flip. This would take just a little scripting to work smoothly but should (theoretically) be doable without it. Note that this doesn't account for 'bellies' or 'hills' in the lines - that would be a different matter completely. Jan 6, 2016 at 1:07

1 Answer 1

3
  1. Create nice unique id for lines
  2. Convert them to 3d using interpolate shape tool
  3. Create field fromZ in above. Use field calculator to populate it, parser Python

    !shape!.firstpoint.z

  4. Populate field toZ, using lastpoint.z

  5. Join 3d lines back to original, using unique id, select ones where fromZ < toZ

  6. Use flip edit TOOL to flip selected.

It works for single part polylines on a terrain steep enough

1
  • Nice workflow Felix. That's fairly much how I've done it before and it's always worked for me except in very rare cases of almost flat short segments (eg braided watercourses). Jan 6, 2016 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.