AnsweredAssumed Answered

Need a script to replace data in a network dataset

Question asked by drose75 on Dec 15, 2016
Latest reply on Dec 16, 2016 by jborgion

Hello - looking for help with a Python script - I have a feature class consumed in a network dataset (street centerlines). Once a month, we get new data, and I need to replace the old with the new.

 

What I want to this Python script to do:- Replace the old data with the new data, - Rebuild the network dataset and address locator.


Issues: - In a non-versioned dataset, the fc cannot be worked with the truncate tool, as the 'Operation not supported on a feature class in a controller dataset', aka, it is still part of the network dataset.

- In a versioned dataset, truncate is "not supported on a versioned table’.

In a versioned dataset, and in an edit session within ArcMap, truncate is also "not supported on a versioned table’.

 

Acknowledgements: - There is no way to remove the fc from the network dataset using Python, because of the inability to work with the feature class wizard. There is also no way to remove the fc from the dataset without removing it from the network dataset. Also, deleting the entire dataset and rebuilding it and the network dataset is not an option, for the same reason with Python/the wizard; (re)building the network dataset IS available to Python.

 

Current, manual workflow: 1. Remove the network dataset components, 2. Remove the old fc, 3. Import the new fc, 4. Rebuild the network dataset based on the new fc, and 5. Rebuild the address locator. This workflow is not repeatable through Python.

 

In another attempt to find a fix, was able to work through the entire process of 1. Registering the dataset as versioned, 2. Start an edit session in ArcMap, 3. Select and delete all assets in the fc, 4. Copy and paste (I know, not the proper method) the new data to the original fc (identical schema), 5. Rebuild the network dataset with the new data, and 6. Unregister the dataset. I'm not able, to put this into a Python script successfully using an existing map document, edit session, select, delete, add, etc. From start to finish, it's clunky and very time-consuming, dealing with 35k assets.

 

I wanted to use truncate and append, but that solution isn't looking like it will work for me. I want this 100% automated, no fingers to touch anything.

 

I've gone through 30 variations of scripts - good learning experience - however... any ideas? Working with SDE database connections and datasets. New data resides in a different db.

Outcomes