Add Network Attribute (Trace Network)

Summary

Adds a network attribute to a trace network.

Usage

  • A network attribute can be associated with only one attribute on a feature class; however, it can be associated with multiple feature classes.

  • The network topology must be disabled.

  • This tool can be used with the Set Network Attribute tool, which is used to assign the network attribute to a feature class field in the trace network.

    Learn more about creating network attributes

  • When working with an enterprise geodatabase, the requirements are as follows:

    • The input trace network must be from a database connection established as the database trace network owner.

    • The connected ArcGIS Enterprise portal account must be the portal trace network owner.

    • License:
      The active portal account must be assigned a license with the ArcGIS Advanced Editing user type extension to create, publish, and work with a trace network in an enterprise geodatabase.
    • To run this tool, it must be connected to the default version.
  • The following table lists the network attribute types and their applicable parameters:

    Attribute typeApportionableNullable

    Short

    Check mark

    Long

    Check mark

    Double

    Check markCheck mark

    Date

    Check mark

Parameters

LabelExplanationData Type
Input Trace Network

The input trace network to which the network attribute will be added.

Trace Network; Trace Network Layer
Attribute Name

The name of the network attribute to add to the trace network.

String
Attribute Type

Specifies the data type of the network attribute.

  • Short (16-bit integer)The field type will be short.
  • Long (32-bit integer)The field type will be long.
  • Double (64-bit floating point)The field type will be double.
  • DateThe field type will be date.
String
Nullable
(Optional)

Specifies whether the network attribute will support null values.

  • Checked—The network attribute will support null values.
  • Unchecked—The network attribute will not support null values. This is the default.

Boolean
Apportionable
(Optional)

Specifies whether the network attribute will be apportioned across multiple edges belonging to the same feature.

Apportioned behavior is only supported with double network attributes. Network attributes with the apportionable property can be assigned to fields in line or point feature classes, but only line features will have apportioned behavior.

To illustrate, consider the shape_length network attribute and a line feature that consists of five edge elements of 20 feet each, where the total length of that line feature is 100 feet. This attribute will be apportioned across all edges. For example, using a function in a connected trace to count the shape length attribute for this line will return a count of 5 because it accounts for each individual edge element and not the entire line. The distribution of the value depends on the percentage along each edge element with respect to the from point of the original feature.

  • Checked—The network attribute will be apportioned.
  • Unchecked—The network attribute will not be apportioned. This is the default.
Boolean

Derived Output

LabelExplanationData Type
Updated Trace Network

The updated trace network.

Trace Network

arcpy.tn.AddNetworkAttribute(in_trace_network, attribute_name, attribute_type, {is_nullable}, {is_apportionable})
NameExplanationData Type
in_trace_network

The input trace network to which the network attribute will be added.

Trace Network; Trace Network Layer
attribute_name

The name of the network attribute to add to the trace network.

String
attribute_type

Specifies the data type of the network attribute.

  • SHORTThe field type will be short.
  • LONGThe field type will be long.
  • DOUBLEThe field type will be double.
  • DATEThe field type will be date.
String
is_nullable
(Optional)

Specifies whether the network attribute will support null values.

  • NULLABLEThe network attribute will support null values.
  • NOT_NULLABLEThe network attribute will not support null values. This is the default.
Boolean
is_apportionable
(Optional)

Specifies whether the network attribute will be apportioned across multiple edges belonging to the same feature.

Apportioned behavior is only supported with double network attributes. Network attributes with the apportionable property can be assigned to fields in line or point feature classes, but only line features will have apportioned behavior.

To illustrate, consider the shape_length network attribute and a line feature that consists of five edge elements of 20 feet each, where the total length of that line feature is 100 feet. This attribute will be apportioned across all edges. For example, using a function in a connected trace to count the shape_length attribute for this line will return a count of 5 because it accounts for each individual edge element and not the entire line. The distribution of the value depends on the percentage along each edge element with respect to the from point of the original feature.

  • APPORTIONABLEThe network attribute will be apportioned.
  • NOT_APPORTIONABLEThe network attribute will not be apportioned. This is the default.
Boolean

Derived Output

NameExplanationData Type
out_trace_network

The updated trace network.

Trace Network

Code sample

AddNetworkAttribute example (Python window)

Add an apportionable network attribute named Velocity with a double attribute type.

import arcpy
arcpy.tn.AddNetworkAttribute("Trace Network", "Velocity", "DOUBLE", "APPORTIONABLE")

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics