Select to view content in your preferred language

Best Practices for Assigning Unique IDs in Utility Networks

149
1
03-20-2025 12:52 PM
Labels (2)
l_al-sabbagh
Emerging Contributor

I'm working with utility networks and want to understand how others handle numbering systems for utility mains and devices. Do you use a custom numbering system, or do you primarily rely on the Global ID field?

Currently, I use a script to generate unique IDs based on the Global ID field, but this process takes time. I’d love to hear if there are more efficient approaches.

 

 

Do you divide your area into zones and incorporate the zone information into the numbering system to make field identification easier for on-site teams?

 

Take a glance at an example of the code I'm using: 

import arcpy
import hashlib

workspace = r"C:\Path\To\Your\Geodatabase.gdb"
input_fc = "YourFeatureClass"
global_id_field, gis_id_field = "GlobalID", "GIS_ID"

if gis_id_field not in [f.name for f in arcpy.ListFields(input_fc)]:
    arcpy.AddField_management(input_fc, gis_id_field, "TEXT", field_length=8)

edit = arcpy.da.Editor(workspace)
edit.startEditing(False, True)

try:
    with arcpy.da.UpdateCursor(input_fc, [global_id_field, gis_id_field]) as cursor:
        for row in cursor:
            if row[0]:
                row[1] = f"GID{int(hashlib.md5(row[0].encode()).hexdigest(), 16) % 10000:04d}"
                cursor.updateRow(row)
    edit.stopEditing(True)
except:
    edit.stopEditing(False)

 

0 Kudos
1 Reply
Lorne_Dmitruk
Emerging Contributor

Check out the attribute rules used to create asset ids using database sequences. 

0 Kudos