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.
- Create nice unique id for lines
- Convert them to 3d using interpolate shape tool
Create field fromZ in above. Use field calculator to populate it, parser Python
Populate field toZ, using lastpoint.z
Join 3d lines back to original, using unique id, select ones where fromZ < toZ
Use flip edit TOOL to flip selected.
It works for single part polylines on a terrain steep enough