ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.UtilityNetwork.Trace Namespace / TracePath Class
Members Example

In This Topic
    TracePath Class
    In This Topic
    Represents traversed information during a path or circuit trace.
    Object Model
    TracePath ClassGeometry ClassElement ClassElement Class
    Syntax
    Public Class TracePath 
    public class TracePath 
    Example
    Run a path trace in the telecom domain network
    await QueuedTask.Run(() =>
    {
      using (TraceManager traceManager = utilityNetwork.GetTraceManager())
      using (NetworkSource deviceNetworkSource = telecomDomainNetwork.NetworkSources.First(f => f.Name.Contains("TelecomDevice")))
      using (AssetGroup assetGroup = deviceNetworkSource.GetAssetGroup("Port"))
      using (AssetType assetType = assetGroup.GetAssetType("Port"))
      {
        Guid startGuid = new Guid("4BB4560A-34F3-4BBA-93D5-C5D6B26F2709");
        Guid stopGuid = new Guid("32203C76-E484-473A-AEA5-B1AB92A0C198");
    
        TelecomElement startElement = utilityNetwork.CreateElement(assetType, startGuid) as TelecomElement;
        TelecomElement stopElement = utilityNetwork.CreateElement(assetType, stopGuid) as TelecomElement;
    
        List<TelecomElement> startingLocations = new List<TelecomElement>() { startElement };
        List<TelecomElement> stoppingLocations = new List<TelecomElement>() { stopElement };
    
        TraceConfiguration traceConfiguration = new TraceConfiguration()
        {
          MaxHops = 100,
          NumPaths = 2,
          DomainNetwork = telecomDomainNetwork,
          ValidateConsistency = true
        };
    
        TraceArgument traceArgument = new TraceArgument(startingLocations)
        {
          StoppingLocations = stoppingLocations,
          Configuration = traceConfiguration,
          ResultTypes = new List<ResultType>() { ResultType.Path },
          ResultOptions = new ResultOptions { IncludeGeometry = true }
        };
    
        PathTracer pathTracer = traceManager.GetTracer<PathTracer>();
        IReadOnlyList<Result> results = pathTracer.Trace(traceArgument, ServiceSynchronizationType.Asynchronous);
        // Iterate through the path trace results
        foreach (Result result in results)
        {
          if (result is PathResult pathResult)
          {
            IReadOnlyList<TracePath> paths = pathResult.Paths;
            foreach (TracePath path in paths)
            {
              Element startLocation = path.StartLocation;
              Element stopLocation = path.StopLocation;
              Geometry pathGeometry = path.Geometry;
              IReadOnlyList<PathConnectivity> pathConnectivities = path.PathConnectivities;
    
              foreach (PathConnectivity pathConnectivity in pathConnectivities)
              {
                Console.WriteLine($"Edge: {pathConnectivity.Edge.GlobalID}, Junction: {pathConnectivity.Junction.GlobalID}");
              }
            }
          }
          else
          {
            Console.WriteLine("Unexpected result type.");
          }
        }
      }
    });
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.UtilityNetwork.Trace.TracePath
          ArcGIS.Core.Data.UtilityNetwork.Trace.OrderedTracePath

    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.7 or higher.
    See Also