ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork Namespace / NetworkAttribute Class
Members Example

In This Topic
    NetworkAttribute Class
    In This Topic
    The NetworkAttribute class is used to represent a network attribute inside a utility network. Network attributes correspond to weights in the geometric network. NetworkAttribute objects can be obtained by calling UtilityNetworkDefinition.GetNetworkAttributes or UtilityNetworkDefinition.GetNetworkAttribute
    Object Model
    NetworkAttribute ClassDomain ClassNetworkAttribute Class
    Syntax
    public sealed class NetworkAttribute : ArcGIS.Core.CoreObjectsBase, System.IDisposable  
    Public NotInheritable Class NetworkAttribute 
       Inherits ArcGIS.Core.CoreObjectsBase
       Implements System.IDisposable 
    Example
    Create a Condition to compare a Network Attribute against a set of values
    // Create a NetworkAttribute object for the Lifecycle network attribute from the UtilityNetworkDefinition
    using (NetworkAttribute lifecycleNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Lifecycle"))
    {
      // Create a NetworkAttributeComparison that stops traversal if Lifecycle <> "In Design" (represented by the constant InDesign)
      NetworkAttributeComparison inDesignNetworkAttributeComparison = new NetworkAttributeComparison(lifecycleNetworkAttribute, Operator.NotEqual, InDesign);
    
      // Create a NetworkAttributeComparison to stop traversal if Lifecycle <> "In Service" (represented by the constant InService)
      NetworkAttributeComparison inServiceNetworkAttributeComparison = new NetworkAttributeComparison(lifecycleNetworkAttribute, Operator.NotEqual, InService);
    
      // Combine these two comparisons together with "And"
      And lifecycleFilter = new And(inDesignNetworkAttributeComparison, inServiceNetworkAttributeComparison);
      
      // Final condition stops traversal if Lifecycle <> "In Design" and Lifecycle <> "In Service"
      traceConfiguration.Traversability.Barriers = lifecycleFilter;
    }
    
    Create a Function
    // Get a NetworkAttribute object for the Load network attribute from the UtilityNetworkDefinition
    using (NetworkAttribute loadNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Load"))
    {
      // Create a function to sum the Load
      Add sumLoadFunction = new Add(loadNetworkAttribute);
    
      // Add this function to our trace configuration
      traceConfiguration.Functions = new List<Function>() { sumLoadFunction };
    }
    
    Create a FunctionBarrier
    // Create a NetworkAttribute object for the Shape length network attribute from the UtilityNetworkDefinition
    using (NetworkAttribute shapeLengthNetworkAttribute = utilityNetworkDefinition.GetNetworkAttribute("Shape length"))
    {
      // Create a function that adds up shape length
      Add lengthFunction = new Add(shapeLengthNetworkAttribute);
    
      // Create a function barrier that stops traversal after 1000 feet
      FunctionBarrier distanceBarrier = new FunctionBarrier(lengthFunction, Operator.GreaterThan, 1000.0);
    
      // Set this function barrier
      traceConfiguration.Traversability.FunctionBarriers = new List<FunctionBarrier>() { distanceBarrier };
    }
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.UtilityNetwork.NetworkAttribute

    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also