Title Trace Files To Geodatabase
Converts the JSON files from a Utility Network trace to a geodatabase.
Only specify Utility Network if the output schema needs to be changed. The tool is additive, so new tables and fields can be added to an existing geodatabase.
The output geodatabase will always have the following tables prefixed with I_. Additional tables will be created based on Schema Options:
- I_File - Stores the name of the JSON file and an incrementing ID
- I_NetworkAttributes - Stores metadata about Utility Network network attributes
- I_Pairs - Stores left/right fileKey values used in the difference views
- I_Sources - Stores metadata about Utility Network source tables
- I_SourceFilter - Stores the names of the sources, fields, and network attributes used when defining the output schema
The difference views can manually be configured by populating the I_Pairs table after loading at least 2 JSON files. For automatic loading, the following JSON can be added to each file which will be used to populate this table. The Batch Trace tool adds the JSON payload for you.
{
"traceInfo": {
"name": "My Subnetwork", // This will be written to I_File. If not specified, the base name of the file will be used.
"moment": 1693260302.855814, // This will be written to I_File. If not specified, the current time will be used.
"key": "a", // Two files with the same value populates I_Pairs.
"side": "left" // "left" represents current/original and "right" represents newer/modified.
}
}
License
Basic
TraceFilesToGeodatabase (output_gdb, {truncate_tables}, {trace_files}, {controller_dataset}, {schema_options}, {output_options}, {source_filter_csv}, {source_filter_json})
Parameter | Explanation | Data Type |
---|---|---|
output_gdb |
Dialog Reference
The target geodatabase to convert the trace results files into. |
DEWorkspace |
truncate_tables (Optional) |
Dialog Reference
Truncates the tables listed in the I_Sources table. |
GPBoolean |
trace_files (Optional) |
Dialog Reference
JSON files from Trace or Export Subnetwork. If a folder is specified, it will be recursively traversed for JSON files. |
GPComposite |
controller_dataset (Optional) |
Dialog Reference
The Utility Network used to define the output schema. Leave blank if the output schema already exists. |
GPUtilityNetworkLayer |
schema_options (Optional) |
Dialog Reference
The tables to create in the Output Geodatabase
|
GPString |
output_options (Optional) |
Dialog Reference
Options enabled when a controller is provided.
|
GPString |
source_filter_csv (Optional) |
Dialog Reference
A table with the sources to include and their fields and network attributes. Use the recordset to define the schema. This parameter cannot be used at the same time as Source Filter JSON. |
GPRecordSet |
source_filter_json (Optional) |
Dialog Reference
Specify one of the output trace results files to restrict the sources and fields in the results. This parameter cannot be used at the same time as Source Filter Table. |
DEFile |
TraceFilesToGeodatabase example 1 (Python window)
convert the trace results from trace_results1 and trace_results2 into features and elements in the report database
import arcpy
files = [
r"c:\temp\trace_results1.json",
r"c:\temp\trace_results2.json",
]
report_database = r"c:\temp\trace_report.geodatabase"
un = r"c:\temp\sample_un.geodatabase\network\utility_network"
arcpy.udms.TraceFilesToGeodatabase(report_database, un, files)
TraceFilesToGeodatabase example 2 (stand-alone script)
convert the trace results from trace_results1 and trace_results2 into features and elements in the report database
import arcpy
files = [
r"c:\temp\trace_results1.json",
r"c:\temp\trace_results2.json",
]
report_database = r"c:\temp\trace_report.geodatabase"
un = r"c:\temp\sample_un.geodatabase\network\utility_network"
arcpy.udms.TraceFilesToGeodatabase(
output_gdb=report_database,
controller_dataset=un,
trace_files=files,
)