How To: Verify and repair a geometric network with Python


This is a workflow for running the Verify and Repair Connectivity tool with the exhaustive check option in a Python script.


Please be aware that this process is very resource intensive and an exhaustive check of the geometric network at full extent can take hours. It is therefore recommended to run this overnight or on a weekend.

  1. Create a fishnet using the extent of the geometric network. Depending on the size and concentration of the network, choose a number of rows and columns that minimize high concentrations of the network. Be sure to select Polygon as the output geometry.

    Using the fishnet decreases the load for this process because the script is run block-by-block rather than for the whole network all at once. One log file is created for each block in the fishnet.

  2. From the fishnet, remove any cells where the geometric network does not have data.
  3. Use the following sample Python script to loop through the extent of each of the cells to perform a verify and repair.

    import arcpy
    grid = r'Database Connections\Connection to GIS_DB.sde\GIS_DB.SDE.Fishnet'

    net = r'Database Connections\Connection to GIS_DB.sde\GIS_DB.SDE.NetworkFeatures\GIS_DB.SDE.Water_Net'
    rows = arcpy.da.SearchCursor(grid,["OID@","SHAPE@"])
    for row in rows:


    ext = row[1].extent

    logfile = r"C:\TEMP\Water_Fishnet_Test_{0}.txt".format(str(row[0]))

    arcpy.VerifyAndRepairGeometricNetworkConnectivity_management(net, logfile, "VERIFY_AND_REPAIR", "EXHAUSTIVE_CHECK", ext)

    print str(row[0]) + " done"


    print str(row[0]) + " failed"

Related Information