How to edit / modify the template xml from network dataset ?

580
3
04-18-2018 11:24 PM
LeoDeng
Occasional Contributor II

Hi All,

   

This attached customized.xml is created as the below workflow:

  1. Created a network dataset manually in Arcmap by using the converted streets, and newly generated turns data.
  2. Added all the attributes that the network dataset needs(for example, oneway, traversable, time, length etc. )
  3. Then exported a xml template(original.xml) from this network dataset using arcmap tool (ArcToolbox > Network Analyst Tools > Network Dataset > Create Network Dataset From Template).
  4. Customized the original.xml template in our c# code by adding new attributes based on how many counties of source data we converted.

(To be specific, if you checked the original.xml  we looped through elements inside the <EdgeFeatureSources></EdgeFeatureSources>, and copy the element and insert to <EdgeFeatureSources>, and changed both <EdgeFeatureSource> name to our converted street feature class name. and we did the similar thing to the <NetworkAssignments></NetworkAssignments>)

 

I can create a network dataset with the customized.xml and built it successfully. But after add two stops along the street and click solve in Arcmap it always failed.

 

So my questions are:

  1. If the network dataset template support add attributes by edit the xml?
  2. If not , how do you suggest solve the need that we want customize network dataset attributes  with arcpy  base on how many counties of source data we converted .
  3. If so, what’s right way to edit the xml.

Thanks,

0 Kudos
3 Replies
MelindaMorang
Esri Regular Contributor

Did you test the original network, before you made the template and the modifications?  Did that network work?

You said the solve failed with the new network.  What was the failure message?  This will likely give some clue about why it failed.

0 Kudos
LeoDeng
Occasional Contributor II

1) The original network is correct, before made the template and modifications. And it worked fine.

2) There was not any failure message. No error dialog or windows popup. The only clue about this is there is a status shows 'solve failed'.

BTW, the quotation mark used in the template xml should be single or double?

Thanks.

0 Kudos
MelindaMorang
Esri Regular Contributor

Sorry it's taken a while to get back to you.  Did you ever get this to work?

To answer your original questions:

1. If the network dataset template support add attributes by edit the xml?

^ Yes.  You can edit the XML template.
3. If so, what’s right way to edit the xml.

^ You should be able to edit it in any way you want, with a text editor manually, with some automated procedure, etc., as long as it remains valid.

The original XML template uses single quotes.  I don't know if it makes a difference, but it seems like it would be safer to keep it the same as the original.  Additionally, I notice that the SpatialReference tag and various other place in the original uses &quot;, but your new template uses an actual " character.  This could be a problem also.  Try using WinMerge to see the differences between the two files.  I really don't know whether this matters, but these differences obscure the actual intentional changes you made, so it's hard for me to find them and see if there is a mistake somewhere there.

0 Kudos