Dissolve Network (Network Analyst)
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)
Syntax
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 |
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. After dissolving,
# 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
from arcpy import env
try:
#Check out the Network Analyst extension license
arcpy.CheckOutExtension("Network")
#Set environment settings
env.workspace = "C:/Data/SanFrancisco.gdb"
env.overwriteOutput = True
#Set local variables
network = "Transportation/Streets_ND"
out_folder = "C:/Data"
output_gdb_name = "SanFranciscoDissolved"
#Create a new file geodatabase that will contain the dissolved network
output_gdb = arcpy.management.CreateFileGDB(out_folder,
output_gdb_name).getOutput(0)
#Dissolve the network dataset
result = arcpy.na.DissolveNetwork(network, output_gdb)
#Get the path to the dissolved network dataset from the result object
dissolved_network = result.getOutput(0)
#The dissolved network dataset is unbuilt, so build it
arcpy.na.BuildNetwork(dissolved_network)
print("Script completed successfully")
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 occured on line %i" % tb.tb_lineno)
print(str(e))