I am upgrading a water utility to ArcMap and Enterprise 10.6.1 from v10.2.1. Part of the upgrade process is to change the coordinate system of all the datasets. I wrote ArcPy code to perform in-place transformation to a new coordinate system. Core logic is;
1. Project all root feature classes and feature classes in the datasets to a temporary geodatabase with intended coordinate system.
2. Truncate all feature classes and datasets in the original workspace.
3. Change the spatial reference of the original workspace datasets and root feature classes to the intended coordinate system.
4. Append projected data from the temporary geodatabase classes back to source datasets and classes.
This avoids dropping existing feature classes keeping all permissions etc same. And it seems to be working correctly.
However, some of the datasets have geometric network and I am struggling to transform these. Most of the commands such as "project" etc do not work on feature classes that participate in the GN. I was hoping to export the geometric network, drop or disable the geometric network, change coordinate system of the datasets using above method and re-import or re-enable the geometric network. Unfortunately, there is no tool to export the geometric network with feature classes that participate in it, all connectivity rules and weights. Even arcpy.Describe does not give me the connectivity rules and weights so that I can write my own "rebuild" geometric network code. Is there any option to programmatically export and import/rebuild a geometric network. Only link I can find is https://www.arcgis.com/home/item.html?id=fa4e4cdd3bf64be7a1287fd1fd12e2f1 which seems to a arcmap 10.2 addin and there is no 10.6+ version for it.
Any help is very much appreciated.
Geodatabase Designer 2 does exactly this but unfortunately hasn't been updated in a LONG time. It still works on 10.2.1 at least although in the link you reference, apparently it doesn't work on some of the newer versions even with the work around. All of the ArcObjects calls still exist and it's the installation method and reliance on the GxDockableWindow that cause problems. So it's possible to reuse the code in a new extension or add-in that doesn't use these and get the same results. But it is a bit of work as there's a lot of code in there. You don't need to do everything though as GDB designer does a lot more than just geometry networks. At the very least, it can be used as a reference for building a process to rebuild a network with all the same parameters.
You can use ModelBuilder to build a model that Creates a Geometric Network, then you can export it to Python. to run it in a script
To delete the Geometric Network
arcpy.Delete_management(FC Network , "GeometricNetwork")
print "Delete Geometric Network"
arcpy.Delete_management(FC Network_Junctions, "FeatureClass")
print "Delete Network Junctions"
arcpy.Delete_management(Table NETWORK_BUILDERR , "Table")
print "Delete Table NETWORK_BUILDERR"
To Create a Geometric Network
# Local variables:
Water = "C:/arcgis/ArcTutor/BuildingaGeodatabase/Montgomery.gdb/Water"
# Process: Create Geometric Network
arcpy.CreateGeometricNetwork_management(Water, "Water_Net", "Distribmains COMPLEX_EDGE NO;Fittings SIMPLE_JUNCTION NO;Hydrants SIMPLE_JUNCTION NO;Sysvalves SIMPLE_JUNCTION NO;Tanks SIMPLE_JUNCTION YES;Transmains COMPLEX_EDGE NO", "0.5", "Friction_Factor DOUBLE #", "Distribmains FRICTION_FACTOR Friction_Factor;Transmains FRICTION_FACTOR Friction_Factor", "", "PRESERVE_ENABLED")
Yes, you can use ArcPy to do a lot of these things as well. Depending on how many you have to do though, it can be a bit of work to manually build the specific scripts for each network. Plus, the OP specified that it's the loading of all the network rules that is a big part of the issue. I would assume there are ArcPy commands for that as well but I've seen some networks with a LOT of rules. So unless you have a process that can generate those, building the python script to do that could be a lot of work as well.
Reading the OP again, I realize I've done something extremely close to what was described as far as wanting to reproject an existing database as opposed to creating a new database. The other part of it for us is that we didn't (or couldn't) delete and replace the features as that would generate new OIDs which could be a problem for relationships both internal and possibly external "soft" relationships as well. Our process was similar as far as projecting to a new GDB and changing the Spatial Reference of the existing classes. But instead of deleting the features and loading in the updated projected features, we left the features as they were and then ran a process to update the geometry of each feature to the geometry from the projected GDB. I likely had to drop spatial indexes to avoid index errors do to the large change in X/Y coordinates. And I also had to regenerate the extents for each feature class after the updates. There may have been a few other updates and fixes that needed to happen to make it all work. And of course I used Geodatabase Designer (or our own version of it) to rebuild the geometric network and relationship after the fact. But it was successful in the end. It's been some time, did you get it to work or are you still working on it?