I am programming OD cost matrix generation in Python and everything was going well till I needed to create the network dataset in order to accomplish network analysis tasks. Would you think there is any module available online that might do this?
I really appreciate your time!
Solved! Go to Solution.
Hello. Unfortunately, creating a network dataset from scratch cannot be done through python.
If you're using ArcGIS Pro, you can create a network dataset using the Create Network Dataset From Template tool, which can be called from python. However, you have to have a template to work from, so you have to have created a network dataset at some point previously to use as a template.
Creating a network dataset—Help | ArcGIS for Desktop the conventional approach
What is the Network Analyst module?—Help | ArcGIS for Desktop via arcpy... if the class or function isn't there, it can't be done without arcobjects
Hello. Unfortunately, creating a network dataset from scratch cannot be done through python.
If you're using ArcGIS Pro, you can create a network dataset using the Create Network Dataset From Template tool, which can be called from python. However, you have to have a template to work from, so you have to have created a network dataset at some point previously to use as a template.
I have multiple gdbs based on regions.
1. I created the network dataset for one gdb manually by using ArcGIS =>New => Network DataSet
2. Used CreateTemplateFromNetworkDataset to export the template
3. To replicate the same template for rest of the gdbs. I want to use python script
Can I use the previous exported template. If yes, Where I need to change/specify on which datasource these template need to be applied. There is no parameter in the tool to mention input dataset
Please let suggest.
Yes, you can use the template you created to make new network datasets in other geodatabases. Set the output_feature_dataset parameter to the feature dataset in the geodatabase where you want to create the network.
Thanks Melinda for quick response.
I tried it, it's not working and throwing below error
Here is error message details.
Messages
Executing: CreateNetworkDatasetFromTemplate C:\.....\HydroNDTemplateNew.xml C:\....\NHDPLUS_H_1406_HU4_GDB.gdb\Hydrography
Start Time: Mon Sep 9 17:30:09 2019
ERROR 030168: The network dataset cannot be created from template xml file.
The network source must correspond to a simple feature class.
Failed to execute (CreateNetworkDatasetFromTemplate).
Failed at Mon Sep 9 17:30:10 2019 (Elapsed Time: 1.26 seconds)
My guess is that one of your source feature classes is not a normal point or line feature class. Maybe it's a multipoint or a raster or some other weird thing.