I am trying export Dirty Areas from invalid Utility Network package using Python (ArcGIS Pro 2.6).
I using this script:
arcpy.conversion.FeatureClassToFeatureClass(r"Network Utility Network\Dirty Areas", r"C:\MyProject1.gdb", "output_fc")
But do not work in my script
the error message you got?
and was that one line your script? it probably can't find your r"Network Utility Network\Dirty Areas" because it probably doesn't know where it is, depending where you are running your script (eg separate IDE, python window, notebook)
Start with providing the error message, then the actual script and where you are running it from.
Indeed, it is an error related to data access. This is the error:
Message=Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset Network Utility Network\Dirty Areas does not exist or is not supported
Failed to execute (FeatureClassToFeatureClass).
arcpy.env.workspace = 'C:\\un.gdb'
arcpy.conversion.FeatureClassToFeatureClass(r"Network Utility Network\Dirty Areas", output_path, "output_fc")
GDB and network:
arcpy.env.workspace = r"C:\...path_to...\un.gdb" # Set local variables inFeatures = "Network Utility Network\Dirty Areas" # never use spaces outLocation = r"C:\... path_to...\Results" # do you want it to a folder or gdb??? outFeatureClass = "output_fc" # --- might want a descriptive name # Execute FeatureClassToFeatureClass arcpy.FeatureClassToFeatureClass_conversion(inFeatures, outLocation, outFeatureClass)
Although I question gdb in the root of C:\ and your use of paths in the featureclass names is a good source of failure. And finally, are you wanting to dump the results to a folder? is it a shapefile? if so, it should end in *.shp
That was drawn from the sample help file code
I don't care how to write the output file, using a gdb or a shp file. In the example it is enough to export a shp file.
It is possible that the use of spaces is giving problems; strange thing is that it does not match structure I have in the utility network package.
I have added the extension to the output file "output.shp" but it still gives the same error, it is a data access issue.
I have attached the network structure, and I have tried different combinations of the code indicating as input layer "UN\Network\Dirty Areas" or "UN\Dirty Areas" or "UN\Network Utility Network\Dirty Areas"; but it doesn't work.
I have attached the structure of the GDB in my previous post.
Thanks Dan !
Maybe what you are trying to say is that I should not use the "FeatureClassToFeatureClass" command to extract Dirty Areas from Network?
I have checked that this function is one used by Arcgis pro 2.6 when I do the same operation from the GUI.
Hi @JonDeRose ,
I have read many of your recent articles about UtilityNetwork, I think you are the most knowledgeable and experienced person on UtilityNetwork right now.
For months I am immersed in a migration process to UtilityNetwork, and all your articles are of great help to be updated on the improvements and new features that tool brings.
As you know topological errors and dirty areas are quite important to carry out migration, when source data does not always follow ESRI topological rules or connectivity rules may vary during a testing period or simply need to better communicate to client thousands of errors and dirty areas that need to be corrected before migrating to UN.
Because of this it becomes very important to be able to debug the dirty areas, to detect well which elements are involved and to correct error quickly. This is why I try to export the invalid areas to shp.