Create Network Dataset From Template (Network Analyst)


Creates a new network dataset with the schema contained in the input template file (.xml). All the feature classes and input tables required for creating the network dataset must already exist before this tool is executed.


  • This tool creates a new network dataset using the schema from the template file. Use the Create Template From Network Dataset tool to create the schema for the new network dataset. The name of the output network dataset is specified in the input template file.

  • The newly created network dataset will need to be built using the Build Network tool.


CreateNetworkDatasetFromTemplate(network_dataset_template, output_feature_dataset)
ParameterExplanationData Type

The template file (.xml) created by the Create Template From Network Dataset tool containing the schema of the output network dataset to be created.


The feature dataset containing the feature classes that will take part in the network dataset being created. The network will be created in this dataset using the name specified in the network dataset template.

Feature Dataset

Derived Output

NameExplanationData Type

A new network dataset with the schema contained in the template file.

Network Dataset

Code sample

CreateNetworkDatasetFromTemplate example 1 (Python window)

Execute the tool using all parameters.

new_network_location = "C:/data/NewNetwork.gdb/Transportation"
xml_template = "C:/data/NDTemplate.xml", xml_template)
CreateNetworkDatasetFromTemplate example 2 (stand-alone script)

The following stand-alone Python script demonstrates how the CreateNetworkDatasetFromTemplate tool can be used to create a new network dataset from an existing template.

# Name:
# Description: Create a new network dataset with the same schema as an existing
#               network dataset
# Requirements: Network Analyst Extension

#Import system modules
import arcpy
import os

    #Check out Network Analyst license if available. Fail if the Network Analyst license is not available.
    if arcpy.CheckExtension("network") == "Available":
        raise arcpy.ExecuteError("Network Analyst Extension license is not available.")
    #Set local variables
    original_network = "C:/data/Region1.gdb/Transportation/Streets_ND"
    new_network_location = "C:/data/Region2.gdb/Transportation"
    xml_template = "C:/data/NDTemplate.xml"
    #Create an XML template from the original network dataset, xml_template)

    #Create the new network dataset in the output location using the template.
    #The output location must already contain feature classes and tables with 
    #the same names and schema as the original network.,
    #Build the new network dataset, "Streets_ND"))

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print(("An error occurred on line %i" % tb.tb_lineno))


Licensing information

  • Basic: Requires Network Analyst
  • Standard: Requires Network Analyst
  • Advanced: Requires Network Analyst

Related topics