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
arcpy.na.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. Note:The output layer created is temporary and will not persist after the session ends. To save the layer to the disk, run the Save To Layer File tool. | Network Dataset Layer |
draw_elements [draw_elements,...] (Optional) | This parameter is not yet supported in ArcGIS Pro. | String |
Code sample
Execute the tool using only required parameters.
networkDataset = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
arcpy.na.MakeNetworkDatasetLayer(networkDataset, "StreetNetwork")
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: Yes
- Standard: Yes
- Advanced: Yes