Software: ArcGIS Pro 2.7In my standalone python script I am able to create a new network dataset in the new file geodatabase and build that network dataset. How can I define a travel mode?
You cannot define a travel mode or alter any other properties of the network dataset from standalone python. We just don't have python methods and classes in place to support that.
The Create Network Dataset tool creates a very basic bare-bones network with a single distance-based impedance attribute. If that's all you need, and you want to make a travel mode from that to use in your analysis, you can call arcpy.nax.TravelMode() and define it on the fly in your script.
However, I suspect it's more likely that you will need to customize your network in more detail to fit your needs. You have to do this manually in the ArcGIS Pro UI. Once you have done it once, you can create a template from that network using the Create Template From Network Dataset tool. If you need to recreate similar networks with the same schema and properties in your code workflow, you can use this xml template with the Create Network Dataset From Template tool.
Hope this helps!
Thanks, trying that now.
On another note, you had sent me an email a little while back and unfortunately I think I must have deleted it by mistake. It was regarding input on a survey I think. You had helped me on another network problem at the 2019 UC. If you still need input I would be happy to help, just resend me the email.
I don't have any specific examples. However, you can do exactly what you said. Just do:
tm = arcpy.nax.TravelMode()
Then update the properties of the travel mode object, which are listed in the documentation.
tm.name = "My awesome travel mode" # Auto-generated distance-based impedance attribute created by running # Create Network Dataset tm.impedance = "Length"
I think you can leave the other properties as default. Not sure. You will have to experiment with it.
Thanks Melinda. I only need the single distance-based impedance attribute. Do you have any examples on how to use arcpy.nax.TravelMode() ? The help documentation only shows how to construct a new Travel Mode Object from an existing Travel Mode. Would I just use newTravelMode = arcpy.nax.TravelMode()?
Thanks Dan, but been there read that.
There is documentation for nax in the help files for python and arcpy
TravelMode—ArcGIS Pro | Documentation
A more general link for all classes and functions is...
What is the Network Analyst module (arcpy.nax)—ArcGIS Pro | Documentation
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.