Generate Network Attributes

The Generate Network Attributes tool accepts an input stream network shapefile, converts it into a NetworkX graph, and then labels all edges within the graph with one of five ‘types’, based on the topological context within the network. These edge types include:

  • Headwaters - edges with no in-flowing edges, which represent water flow sources for the drainage network.
  • Connectors - natural streams, or connecting edges within a water body
  • Mainflow - a named stream within the network (e.g. GNIS_Name)
  • Braids - stream channels separated by temporary islands or bars
  • Outflow - the stream reach where all flowing water flows out of the network

In addition, the Generate Networks Attributes can produce a point shapefile representing node features within the stream network, and optionally, the tool can calculate the distance in river kilometers from each reach to the network outflow.



  • ArcGIS: version 10.4 or higher
  • GDAL: A separate installation of the Geospatial Data Abstraction Library is required by this tool, in order to directly convert between shapefiles and NetworkX graphs. Because GNAT users must operate ArcGIS in a Windows environment, we strongly recommend that the user installs GDAL separately using the Windows binaries offered by Tamas Szekeres at GISInternals. Detailed instructions for installing the GDAL binaries area available here.
  • NetworkX 1.11: Please note, GNAT has only been tested with version 1.11. Other versions have not been tested and are not currently supported.

Input Parameters


Input stream network shapefile

Line shapefile representing a drainage network. Ideally this network should be a USGS NHD flowline dataset, or derived from NHD. Also, all canal features (i.e. FCode = 336) MUST be removed prior to running the tool.


Output shapefile (line)

Stream network shapefile generated by the tool, with new attribute fields appended. The new fields include:

  • _edgetype_ : string field with edge types, in which each stream feature is assigned one of five types, includeing headwater, connector, mainflow, braid, outflow.
  • _river_km_ : calculated river kilometers for each stream feature, representing distance traversing the network to the nearest outflow reach.

Output shapefile (point)

The tool will also produce a secondary shapefile, which have the primary output shapefile name, but with “_node” appended to the file name. This shapefile represents nodes within the network, and includes the attribute field _node_type_ which stores the following values describing the type edge connections that the node represents:

  • BB: braid-braid
  • BC: braid-connector
  • BH: braid-headwater
  • BM: braid-mainflow
  • BO: braid-outflow
  • CC: connector-connector
  • HC: headwater-connector
  • TC: tributary confluence
  • H: headwater
  • O: outflow

Calculate river kilometers (optional)

When this option is selected, the tool will calculate the distance of each feature, along the network to the outflow of the subnework. The calculated distance values are in kilometers.

Technical Background

Calculation Method

The Generate Network Attributes tool relies on the excellent NetworkX Python library, which is in turn based on graph theory concepts. This tool converts the input stream network shapefile into a graph object, which is how the file is then processed throughout the workflow, until being converted back into a shapefile.



The Generate Network Attributes tool is the second step in GNAT Toolbox’s Stream Network Preparation workflow. We recommend running the Generate Stream Order tool next.

Troubleshooting and Potential Issues

Topological errors in the input stream network shapefile will likely cause issues when running the Generate Network Attributes tool. Ideally the user should use the output shapefile generated by the Find Subnetworks tool as the input shapefile for this tool.