Summary
Creates a network dataset layer from a network dataset.
A network dataset is opened each time the network dataset is used as input to a geoprocessing tool. Opening a network dataset is expensive, as they contain advanced data structures and tables that are read and cached. A network dataset layer, which opens the dataset only a single time, will perform better in subsequent tools than reusing the network dataset.
Usage
A network dataset layer can be used in any workflow that uses a network dataset as input.
The network dataset layer created by the tool is temporary and does not persist after the session ends, unless it is saved. To save the layer to the disk, run the Save To Layer File tool.
Network dataset layers created from this tool can import symbology from existing network dataset layer files using the Apply Symbology From Layer tool.
The available choices for the Network Elements to Draw parameter are based on the network elements supported by the network dataset. For example, if a network dataset does not support traffic and turns, those choices will not be available.
When performing network analysis within a loop in a Python script, create the network dataset layer outside the loop and perform the analysis within the loop to improve performance.
When performing network analysis using geoprocessing services, if the network dataset is referenced by a catalog path, it is opened each time a geoprocessing tool within the service executes. By using a network dataset layer instead of referencing it by a catalog path, there is a performance advantage, as when the geoprocessing service is published, the dataset is opened once when the service starts, and its connection properties are cached.
Syntax
MakeNetworkDatasetLayer(in_network_dataset, output_layer, {draw_elements})
Parameter | Explanation | Data Type |
in_network_dataset | The network dataset from which to make the new layer. | Network Dataset Layer |
output_layer | The name of the network dataset layer to be created. The layer can be used as an input to any geoprocessing tool that accepts a network dataset layer as input. | Network Dataset Layer |
draw_elements [draw_elements,...] (Optional) | The type of network elements to be drawn by the output layer. The available options depend on the network elements supported by the input network dataset. If the network dataset supports traffic, the default will be TRAFFIC; otherwise, it will be EDGES. This parameter only enables or disables the types of network elements to draw with the network dataset layer. The enabled elements are drawn using default symbology. To draw the elements using a specific symbology, first define the symbology for the network elements using the Layer Properties dialog box in ArcMap, and save the network dataset layer as a layer file that can be subsequently used to import the symbology on new layers. When an existing network dataset layer is specified as the input network dataset, this parameter inherits the network elements to draw from those that are defined on the input layer. | String |
Code sample
MakeNetworkDatasetLayer example 1 (Python window)
Execute the tool using only required parameters.
networkDataset = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
arcpy.na.MakeNetworkDatasetLayer(networkDataset, "StreetNetwork")
MakeNetworkDatasetLayer example 2 (Python window)
Execute the tool using required and optional parameters.
networkDataset = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
arcpy.na.MakeNetworkDatasetLayer(networkDataset, draw_elements=["EDGES","TURNS"])
Environments
Licensing information
- Basic: Requires Network Analyst
- Standard: Requires Network Analyst
- Advanced: Requires Network Analyst