Select to view content in your preferred language

Create Network Dataset from Arcpy

163
3
03-13-2025 12:42 PM
EmmaButzler
Emerging Contributor
import arcpy

arcpy.CheckOutExtension("network")

new_network_location = r"C:\\GIS590\\RawData_Preprocessing_Dev\\Changed_Features.gdb\\Changed_Features_ND"
xml_template = r"C:\\GIS590\\RawData_Preprocessing_Dev\\Roads_Again_Dataset_Template.xml"
arcpy.na.CreateNetworkDatasetFromTemplate(xml_template,new_network_location)

Above is the code i am using. This works in the ArcGIS environment but when I run this through Arcpy in VSCode. The ND is built but it doesn't populate the properties that are within the XML instead i get a properties section that looks like this. 

EmmaButzler_0-1741894921682.png

Why does this occer?

 

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

Create Network Dataset From Template (Network Analyst)—ArcGIS Pro | Documentation

the second code example seems to specify a original network dataset as one of its setup parameters


... sort of retired...
0 Kudos
EmmaButzler
Emerging Contributor

Thanks for your response. I tried this and i still got the same "Cannot connect to database" 

 

0 Kudos
MelindaMorang
Esri Regular Contributor

There's not enough information here to diagnose the problem.  That "Cannot connect to database" error usually appears when either something is terribly wrong or there's a bug in Pro.  Technically users should never see that!  Are you able to share your data and template (send me a private message if you wish to share privately)?  Also, what version of ArcGIS Pro are you running?

0 Kudos