I'm working on some Python scripts to automate the rebuilding of a couple of different network datasets based on new data coming in from our SDE. To ensure I wouldn't experience any SDE related issues (not really a database guy), I set up the network datasets in a FGDB. However, I'm experiencing some performance issues have decided to try to move the NDs to a feature dataset in SDE. This is where my issues have started coming up.
Since creating NDs isn't possible via ArcPy without getting into areas waaaay outside my skill level, I've got my scripts creating new edge and junction feature classes in memory, removing all rows in the participating ND feature classes, inserting the new features from memory into the empty participating feature classes, and rebuilding the existing ND. I created a new ND in our SDE, and attempted to run my first test, but hit issues when I began my update cursor to delete the participating features. Got the ol Workspace is Already in Transaction Mode error. I tried to register the feature dataset as versioned to see if that would help things, but since SDE NDs don't allow for versioning of feature classes that already participate in NDs, I couldn't. I'm at a loss here. Here's a code sample (sorry that it's an image, can't get code formatted to look right otherwise):
If there is a suggestion on how to get this code working OR another idea on how to handle regular updates of network datasets without manual creation of new NDs, please let me know. Any help is tremendously appreciated!!
Solved! Go to Solution.
If you use ArcGIS Pro, you can automatically re-create the network dataset from a template using the Create Template From Network Dataset and Create Network Dataset From Template tools.
If you use ArcGIS Pro, you can automatically re-create the network dataset from a template using the Create Template From Network Dataset and Create Network Dataset From Template tools.
Unfortunately, we're running 10.4.1, so that option isn't available. Good suggestion though! Hoping to get my hands on Pro sometime soon to play around with. However, if I was able to create a ND XML template via Pro through some other avenue, is there a "scenic route" I could possibly take to utilize that XML in 10.4?
Resurrecting this one: we just started using Pro within the last couple of weeks and I have successfully been able to utilize ND templates. Truly a lifesaver. Thank you!
Hopefully you can use Melinda's suggestion to using the GP tool.
But I want to clarify one thing. You say:
" I tried to register the feature dataset as versioned to see if that would help things, but since SDE NDs don't allow for versioning of feature classes that already participate in NDs, I couldn't. I'm at a loss here."
A feature dataset containing a network dataset CAN be versioned. And then the feature classes that are taking part in a network dataset can be edited.
Jay Sandhu
Thanks for the reply Jay. Unfortunately our organization isn't using Pro, so that door is mostly closed. I forgot to edit my post, but I did learn that versioning was possible (in fact, I had already registered the participating fcs as versioned before posting) but I still didn't have any success. The source for my edge features is too large for my poor little computer to handle and though I didn't realize it at the time, I was running out of memory mid-build. I have another workaround I'm experimenting with, so hopefully it will take care of it.