<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create a Network Dataset using a Template in ArcPy - Error in ArcGIS Network Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37216#M359</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to create a network dataset using a template in Arcpy (my current installed version of ArcPro is 2.2.4 and I'm using the python version&amp;nbsp;associated with this). I'm going to have to make around 20 of these and would prefer to not need to make them manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My hope was to create one, export the xml template, and then use that in a loop for each required network dataset (e.g. Network_2018, Network_2019 etc...). I assumed that by editing the input&amp;nbsp;feature class and output network name in the xml to suit each required parameter&amp;nbsp;this shouldn't be a problem (the schema is identical on all of these feature classes).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my current code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"network"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

new_network_location &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\Gavin\Desktop\Test Folder\Test_Geodatabase\TM_Analysis.gdb\Networks"&lt;/SPAN&gt;
xml_template &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\Gavin\Desktop\Test Folder\Template_ND.xml"&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;na&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateNetworkDatasetFromTemplate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;new_network_location&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; xml_template&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It all feels fairly straight forward, but I've been trying to get even a test version to work and I'm receiving the following error (this is before any changes to the xml or looping through different networks etc.):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 030176: The input file is not a valid XML file.&lt;BR /&gt;ERROR 030178: The output feature dataset is not valid.&lt;BR /&gt;Failed to execute (CreateNetworkDatasetFromTemplate).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gavin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:26:24 GMT</pubDate>
    <dc:creator>GThomson</dc:creator>
    <dc:date>2021-12-10T21:26:24Z</dc:date>
    <item>
      <title>Create a Network Dataset using a Template in ArcPy - Error</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37216#M359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to create a network dataset using a template in Arcpy (my current installed version of ArcPro is 2.2.4 and I'm using the python version&amp;nbsp;associated with this). I'm going to have to make around 20 of these and would prefer to not need to make them manually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My hope was to create one, export the xml template, and then use that in a loop for each required network dataset (e.g. Network_2018, Network_2019 etc...). I assumed that by editing the input&amp;nbsp;feature class and output network name in the xml to suit each required parameter&amp;nbsp;this shouldn't be a problem (the schema is identical on all of these feature classes).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my current code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CheckOutExtension&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"network"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

new_network_location &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\Gavin\Desktop\Test Folder\Test_Geodatabase\TM_Analysis.gdb\Networks"&lt;/SPAN&gt;
xml_template &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\Users\Gavin\Desktop\Test Folder\Template_ND.xml"&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;na&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CreateNetworkDatasetFromTemplate&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;new_network_location&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; xml_template&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It all feels fairly straight forward, but I've been trying to get even a test version to work and I'm receiving the following error (this is before any changes to the xml or looping through different networks etc.):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.&lt;BR /&gt;ERROR 030176: The input file is not a valid XML file.&lt;BR /&gt;ERROR 030178: The output feature dataset is not valid.&lt;BR /&gt;Failed to execute (CreateNetworkDatasetFromTemplate).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gavin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37216#M359</guid>
      <dc:creator>GThomson</dc:creator>
      <dc:date>2021-12-10T21:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Network Dataset using a Template in ArcPy - Error</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37217#M360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see anything obviously wrong with your code.&amp;nbsp; What happens if you try running the tool manually in Pro?&amp;nbsp; Do you get the same errors?&amp;nbsp; If so, the problem is not within your script but something to do with your input data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2019 20:27:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37217#M360</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2019-01-24T20:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Network Dataset using a Template in ArcPy - Error</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37218#M361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What happens if you go this route:(no pun intended...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #4c4c4c; background-color: #ffffff; font-size: 17px; margin-bottom: 1.55rem;"&gt;CreateNetworkDatasetFromTemplate_na (network_dataset_template, output_feature_dataset)&lt;/PRE&gt;&lt;P&gt;(&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/network-analyst/create-network-dataset-from-template.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/network-analyst/create-network-dataset-from-template.htm"&gt;Create Network Dataset From Template—ArcGIS Pro | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2019 20:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37218#M361</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-01-24T20:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Network Dataset using a Template in ArcPy - Error</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37219#M362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh yeah, duh, sorry.&amp;nbsp; Joe is correct.&amp;nbsp; You just have the parameters in the reverse order of what they should be.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2019 20:50:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37219#M362</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2019-01-24T20:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Network Dataset using a Template in ArcPy - Error</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37220#M363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's great thanks! It's always the little things you miss! Works perfectly now, so I should be able to get that looping process going now (fingers crossed)!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2019 21:16:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/create-a-network-dataset-using-a-template-in-arcpy/m-p/37220#M363</guid>
      <dc:creator>GThomson</dc:creator>
      <dc:date>2019-01-24T21:16:57Z</dc:date>
    </item>
  </channel>
</rss>

