BatchTrace

Title  Batch Trace

Description

Iterate through the starting points to trace the utility network and use the results.

Usage

          
This tool uses a with starting point information to trace the utility network. The starting points are optionally grouped so set of starting points is used in each trace.
The trace results can be used to select features in a map, calculate values on results, create connectivity and element files or save the aggregated geometry with summary information.
The starting points layer uses a field to determine if a row is a starting point and/or barrier. A feature as a starting point and filter barrier is useful in a connected trace to determine all the items between the starting points.

The starting points table requires the following fields:
  • FEATUREGLOBALID: GUID or GLOBALID: GlobalID
  • TERMINALID: Short
  • PERCENTALONG: Double

License

Standard

Syntax

BatchTrace (in_utility_network, trace_locations, result_types, trace_config, {expression}, {output_folder}, {key_field}, {summary_store_field}, {fields}, {calc_on_start}, {history_field}, {default_terminal_id})

Parameter Explanation Data Type
in_utility_network Dialog Reference

The utility network that will be used to trace.

GPUtilityNetworkLayer
trace_locations Dialog Reference

The table from which to load starting points for trace.

GPTableView
result_types Dialog Reference

Specifies the type of results that will be returned by the trace.

  • Selection - The trace results will be returned as a selection set on the appropriate network features.
  • Aggregated Geometry - The trace results will be aggregated by geometry type and stored in multipart feature classes displayed in the layers in the active map.
  • Connectivity - The trace results will be returned as a connectivity graph in a specified output .json file. This option requires the Output JSON parameter.
  • Elements - The trace results will be returned as feature-based information in a specified output .json file. This option requires the Output JSON parameter.
  • Calculate - Update a field in the trace results from information on the starting points. If multiple starting points are used, the value from the lowest OID is used.

GPString
trace_config Dialog Reference

The utility network trace configuration used to define the trace parameters or a field with trace configurations.

GPString
expression (Optional) Dialog Reference

The simple calculation expression used to limit the starting points used in a trace.

GPSQLExpression
output_folder (Optional) Dialog Reference

The location of the output items. If specified, a stats mobile geodatabase is created here. The folder is required for the Connectivity, Elements and Aggregated Results result types. For Connectivity and Elements result types, the json_files folder will contain the resulting files. For the Aggregated Results result type, a mobile geodatabase called AggregatedGeometry is created in this location.

DEFolder
key_field (Optional) Dialog Reference

Field used to group starting points and barriers. When specified, records with the same value will used for a single trace. By default, a trace is run for every starting point.

Field
summary_store_field (Optional) Dialog Reference

Optional field used to store summary results on the starting points.

GPString
fields (Optional) Dialog Reference

The mapping of starting points field to network source field. This parameter is only applicable for the Calculation result type. Mapping components are as follows:

  • From Field - The field from the starting points to propagate.
  • Source Name - The name of the utility network source.
  • To Field - The field on the source class to update.
  • Calculation Mode - How to combine values.
Calculation mode supports:
  • Concatenate with existing - Read existing values and combine with new values.
  • Concatenate and overwrite - Combine new values.

GPValueTable
calc_on_start (Optional) Dialog Reference

If specified, the calculate will also update the features the starting points are placed on.

GPBoolean
history_field (Optional) Dialog Reference

A field with a historical date value(as a string) that will be used to run a trace in a previous moment to compare to the current moment.

Field
default_terminal_id (Optional) Dialog Reference

The default terminal ID for starting locations when the terminal ID field is not present or null and the percent along value is less than 0.

GPLong

Code Samples

BatchTrace example 1 (Python window)

Iterate through the starting points to trace the utility network and use the results.

import arcpy

arcpy.udms.BatchTrace(
    "D:/data/UtilityNetwork.gdb/UtilityNetwork/Network",
    "D:/data/TraceLocations.gdb/Starting_Points",
    [
        "SELECTION",
        "AGGREGATED_GEOMETRY",
        "CONNECTIVITY",
        "ELEMENTS",
        "CONTAINMENT_AND_ATTACHMENT_ASSOCIATIONS",
        "FEATURES",
    ],
    "D:/data/",
    None,
    None,
    "SectionName",
    None,
    "Trace Config:: Connected Items",
    None,
    None,
)

BatchTrace example 2 (stand-alone script)

Iterate through the starting points to trace the utility network and use the results.

import arcpy

utility_network = "D:/data/UtilityNetwork.gdb/UtilityNetwork/Network"
trace_locations = "D:/data/TraceLocations.gdb/Starting_Points"
result_types = [
    "SELECTION",
    "AGGREGATED_GEOMETRY",
    "CONNECTIVITY",
    "ELEMENTS",
    "CONTAINMENT_AND_ATTACHMENT_ASSOCIATIONS",
    "FEATURES",
]
output_folder = "D:/data"
key_field = "SectionName"
trace_config = "Trace Config:: Connected Items"

arcpy.udms.BatchTrace(
    utility_network=utility_network,
    trace_locations=trace_locations,
    result_types=result_types,
    output_folder=output_folder,
    summary_store_field=None,
    field_mapping=None,
    key_field=key_field,
    expression=None,
    trace_config=trace_config,
    calc_on_start=None,
    history_field=None,
)