Hello,
I am trying to extract the Dirty Areas layer from a Utility Network, but I have not succeeded.
I am trying using the command:
Input_Features="c:\...gdbUtilityNetwork\Network".
Output_Folder="c:\output.shp"
arcpy.conversion.FeatureClassToShapefile(Input_Features, Output_Folder)
As a result I get an error message saying that the input file is not supported.
https://pro.arcgis.com/es/pro-app/latest/tool-reference/conversion/feature-class-to-shapefile.htm
On the other hand, I try to get properties of topology network to know if there are dirty areas or not; for example the dirty area count.
I am using python 3.6 and ArcGIS Pro 2.6
Best regards!
Solved! Go to Solution.
Here is a little sample I put together that is working:
import arcpy
gdb = r'C:\temp\Communications_UtilityNetwork.gdb'
d = arcpy.Describe(rf'{gdb}\UtilityNetwork\Network')
da_path =fr"{gdb}\UN_{d.DSID}_DirtyAreas"
Output_Folder="C:\\results"
da_d = arcpy.Describe(da_path)
da_da = arcpy.da.Describe(da_path)
print(da_d.catalogPath)
print(da_da['catalogPath'])
print(da_path==da_d.catalogPath)
arcpy.Exists(da_path)
arcpy.GetCount_management(da_path)
arcpy.FeatureClassToFeatureClass_conversion(da_path,r'c:\temp\temp.gdb','DAExport')
You can access the Dirty Areas from the Utility Network Composite layer in the map. Use the Dirty Area sublayer in your GP tool, or open the properties and look at the source to get the path. If you need to access it outside of pro, you will need to use that path from the sublayer. The Dirty Area is always named like UN_<DSID>_DirtyAreas. The DSID is the dataset ID of the utility network. You can find the DSID of the UN in a number of ways, but I just usually look for the terminal attribute domain. It will be in the format of UNName_DSID_TerminalNames. The number in the middle is the DSID.
So in a GP tool, use a path like
C:\temp\1_ElectricUtilityNetworkFoundation\Database\UNAdmin@PostgreSQL@Electric_2022_01_27.sde\UN_11_DirtyAreas
Thank you for your answer, it is very useful !
I have detected the DSID and managed to access the DirtyAreas layer:
ad = arcpy.da.Describe(r'C:\un_water.gdb\UN\Network')
Input_Features=f"C:\\un_water.gdb\\UN\\Network\\UN_{ad['DSID']}_DirtyAreas"
Output_Folder="C:\\results"
desc_da=arcpy.da.Describe(Input_Features)
The object desc_dirty_areas has the description of the layer, so it exists. I can also get the full path to the same object with the "catalogPath" property:
arcpy.conversion.FeatureClassToShapefile(desc_da['catalogPath'], Output_Folder)
When I run this I get an error that the resource does not exist or is not supported.
I try to do an arcpy.GetCount on the dirty areas sublayer and get an error:
I have not found documentation on how to deal with sublayers in arcpy; maybe I am missing some intermediate step to use the layer??
note that I'm using a FGDB not a corporate database; can it influence?
Thanks!
Here is a little sample I put together that is working:
import arcpy
gdb = r'C:\temp\Communications_UtilityNetwork.gdb'
d = arcpy.Describe(rf'{gdb}\UtilityNetwork\Network')
da_path =fr"{gdb}\UN_{d.DSID}_DirtyAreas"
Output_Folder="C:\\results"
da_d = arcpy.Describe(da_path)
da_da = arcpy.da.Describe(da_path)
print(da_d.catalogPath)
print(da_da['catalogPath'])
print(da_path==da_d.catalogPath)
arcpy.Exists(da_path)
arcpy.GetCount_management(da_path)
arcpy.FeatureClassToFeatureClass_conversion(da_path,r'c:\temp\temp.gdb','DAExport')