Reverse the orientation of polylines using elevation data




    1. Prepare your polyline data by copying elevation values into 2 fields called [UpEle] and [DownEle]. Make sure you are using these field names as these are what the script is looking for.

Your data may have elevation already encoded into it but if it does not then you can use the following technique to copy elevation values into your polyline dataset. Make sure you join the the Nodes to the correct Node field in the polyline data as discussed below!

      1. Extract nodes using RivEX.
      2. Assign elevation values to the nodes using a geo-processing tool such as surface spot (3D Analyst). This tool takes a point dataset (in this case your river nodes) and uses them to query a DTM. This particular tool writes back the elevation value to the point dataset using the default field name spot.
      3. Add two new fields called [upEle] & [DownEle] to your polyline layer. Do not include the [] brackets.
      4. Create a Join using the Fnode field in the polyline table with NodeID field in node table. Note: you are joining the Node layer to the Polyline layer, not the other way around!
      5. Do a calculate on [upEle] and copy the elevation values into it. As you have joined the Node layer to the polyline layer in step 4, you will see the elevation field to copy (if you have used the surface spot tool then the field name is spot).
      6. Having copied the elevation values into [UpEle] remove the Join.
      7. Create a new join using Tnode with NodeID. Note: you are joining the Node layer to the Polyline layer, not the other way around!
      8. Do a calculate on [DownEle] and copy the elevation values into it.
      9. Remove Join.
    1. Open the attribute table for the polyline dataset and right click on the Shape Field and select "Calculate values. . .". If you are an ArcGIS 9.3 user you will have to highlight the Shape Field column and then press SHIFT + CRTL + F altogether to open the Field calculator at the Shape field.
    2. Click on the Load. . . button and load the calculation script which you can download here (make sure you save it with a .cal file name extension) . Click on OK to complete the calculation.
    3. All polylines will be re-orientated if their From-Node elevation [FromEle] is less than their To-Node [ToEle] elevation. If a polyline was pointing in a downstream direction then its from-node must be higher than its to-node.


RivEX Logo