Summary
Creates a network dataset that minimizes the number of line features required to correctly model the input network dataset. The more efficient output network dataset reduces the time required to solve analyses, draw results, and generate driving directions. This tool outputs a new network dataset and source feature classes; the input network dataset and its source features remain unchanged.
Learn more about how Dissolve Network worksIllustration
Usage
This tool does not create a built network. Use the Build Network tool to build the newly created network dataset prior to performing any analysis on it.
The network dataset and feature classes created in the output geodatabase workspace have the same feature dataset name, network dataset name, and feature class names as the input network dataset. The tool fails to execute if any datasets with these names already exist in the output geodatabase workspace.
Only fields from the source feature class that are used by the network dataset are transferred to the output line feature class. Examples of fields include:
- Elevation fields
- Fields used in network attribute evaluators (length, time, one-way restrictions, hierarchy, and so on)
- Fields used in generating driving directions (Street names, Shield, and so on)
If the network dataset being dissolved does not contain any 10.1 functionality, a 10.0 network dataset is created.
Syntax
arcpy.na.DissolveNetwork(in_network_dataset, out_workspace_location)
Parameter | Explanation | Data Type |
in_network_dataset | The network dataset to be dissolved. The input network dataset must be a file or personal geodatabase network dataset with exactly one edge source. Any number of junction sources and turn sources is allowed. The edge source must have:
The input network dataset must be built before it can be used in this tool. | Network Dataset Layer |
out_workspace_location | The geodatabase workspace in which to create the dissolved network dataset. The workspace must be an ArcGIS 10 geodatabase or later, and it must be a different geodatabase than the one where the input network dataset resides. | Workspace |
Derived Output
Name | Explanation | Data Type |
out_network_dataset | A network dataset with fewer line features, which results in faster network analyses. | Network Dataset |
Code sample
Execute the tool using all parameters.
network = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
out_gdb = "C:/Data/DissolvedNetwork.gdb"
arcpy.na.DissolveNetwork(network, out_gdb)
The following stand-alone Python script demonstrates how the DissolveNetwork tool can be used to create a new network dataset with a reduced number of line features.
# Name: DissolveNetwork_Workflow.py
# Description: Creates a new network dataset with reduced number of line
# features in a new file geodatabase workspace. The network dataset
# is also built so that it can be used to perform network analyses.
# Requirements: Network Analyst Extension
#Import system modules
import arcpy
try:
#Check out Network Analyst license if available. Fail if the Network Analyst license is not available.
if arcpy.CheckExtension("network") == "Available":
arcpy.CheckOutExtension("network")
else:
raise arcpy.ExecuteError("Network Analyst Extension license is not available.")
#Set environment settings
arcpy.env.workspace = "C:/data/SanFrancisco.gdb"
arcpy.env.overwriteOutput = True
#Set local variables
inNetworkDataset = "Transportation/Streets_ND"
outFolder = "C:/data/output"
outputGDBName = "SanFranciscoDissolved"
#Create a new file geodatabase that will contain the dissolved network
result = arcpy.CreateFileGDB_management(outFolder, outputGDBName)
#Get the path to the newly created file gdb from the result object.
outputGDB = result.getOutput(0)
#Dissolve the network dataset
result = arcpy.DissolveNetwork_na(inNetworkDataset, outputGDB)
#Get the path to the dissolved network dataset from the result object
dissolvedNetworkDataset = result.getOutput(0)
#The dissolved network dataset is unbuilt. So build the network dataset
arcpy.BuildNetwork_na(dissolvedNetworkDataset)
print("Script completed successfully")
except Exception as e:
print(e)
Environments
Licensing information
- Basic: Requires Network Analyst
- Standard: Requires Network Analyst
- Advanced: Requires Network Analyst