How to check if topology is enabled using Python?

681
2
Jump to solution
01-09-2020 04:30 PM
NeilEtheridge
New Contributor III

Is there a way to tell if topology is enabled on a Utility Network using Python?  It would seem using Describe on the Utility Network should give this information - there is loads of information about the network but this seems to be missing. 

The documentation for Describe on a Utility Network Utility Network Properties—ArcPy Functions | ArcGIS Desktop shows printing a property called "properties" (d.properties) which just returns <geoprocessing describe data object object at 0x000001FE8EC06650> but is omitted from being listed in the table of Properties on this page so you don't know what attributes this object supports.

When topology is disabled there is a single Dirty Area and I thought this would be another way to check but I'm not sure how to get a count of the Dirty Areas either.

Thanks,

Neil

0 Kudos
1 Solution

Accepted Solutions
PaulLeBlanc1
Esri Contributor

In short:

import arcgisscripting
un = arcgisscripting.un.UtilityNetwork('<path to UN>')
return un.HasValidNetworkTopology()

Long explanation:

This information is not accessible from arcpy.Describe() because it is not stored in the DataElement (XML). The topology state (among other properties) is stored in the internal properties table of the UN.

All of the hidden UN tables should be accessible via python (you need direct access to the database though). They follow the form:

UN_<DSID>_<table name> where the DSID is the dataset ID of the UN itself.

View solution in original post

2 Replies
PaulLeBlanc1
Esri Contributor

In short:

import arcgisscripting
un = arcgisscripting.un.UtilityNetwork('<path to UN>')
return un.HasValidNetworkTopology()

Long explanation:

This information is not accessible from arcpy.Describe() because it is not stored in the DataElement (XML). The topology state (among other properties) is stored in the internal properties table of the UN.

All of the hidden UN tables should be accessible via python (you need direct access to the database though). They follow the form:

UN_<DSID>_<table name> where the DSID is the dataset ID of the UN itself.

NeilEtheridge
New Contributor III

Thanks Paul.  Perfect!

0 Kudos