Copy Network Analysis Layer (Network Analyst)

Summary

Copies a network analysis layer to a duplicate layer. The new layer will have the same analysis settings and network data source as the original layer and a copy of the original layer's analysis data.

Usage

  • The tool makes a copy of the input network analysis layer's analysis data (the feature classes and tables referenced by the network analysis layer's sublayers and subtables). The layer's network data source is not copied.

  • The analysis data is copied to the Current Workspace environment. If this environment is not set, the data is copied to the same geodatabase that contains the analysis data for the input network analysis layer.

Parameters

LabelExplanationData Type
Input Network Analysis Layer

The network analysis layer to copy.

Network Analyst Layer
Output Layer Name
(Optional)

The name of the network analysis layer to create.

String

Derived Output

LabelExplanationData Type
Output Network Analysis Layer

The newly created network analysis layer.

Network Analyst Layer

arcpy.na.CopyNetworkAnalysisLayer(in_network_analysis_layer, {out_layer_name})
NameExplanationData Type
in_network_analysis_layer

The network analysis layer to copy.

Network Analyst Layer
out_layer_name
(Optional)

The name of the network analysis layer to create.

String

Derived Output

NameExplanationData Type
out_network_analysis_layer

The newly created network analysis layer.

Network Analyst Layer

Code sample

CopyNetworkAnalysisLayer example 1 (Python window)

The following code snippet demonstrates how to copy a network analysis layer in the map using the Python window.

import arcpy

# Retrieve the existing network analysis layer named "Route" from the map
project = arcpy.mp.ArcGISProject("CURRENT")
map_object = project.listMaps()[0]
route_layer = map_object.listLayers("Route")[0]

# Copy the existing layer to a new layer
copied_route_layer = arcpy.na.CopyNetworkAnalysisLayer(route_layer, "Copied Route").getOutput(0)

# Perform further analysis as desired
arcpy.na.Solve(copied_route_layer)

Environments

Licensing information

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

Related topics