分配属性

摘要

以下属性是在公共设施网络中使用 Describe 时由 assignments 对象返回的。

属性

属性说明数据类型
evaluator
(只读)

evaluator 对象。 此对象可用于检索赋值器的属性。

Object
networkAttributeID
(只读)

属性分配的 ID。

Integer
networkSourceName
(只读)

属性源的名称。

String

代码示例

公共设施网络分配和赋值器属性示例(独立脚本)

以下独立 Python 脚本可打印某些公共设施网络属性的报告。

# Import required modules
import arcpy

# Describe function on a Utility Network
UN = "C:\\MyProject\\databaseConn.sde\\mygdb.USER1.Naperville\\mygdb.USER1.ElectricNetwork"
d = arcpy.Describe(UN)

# Network Attribute properties
netattrs = d.networkAttributes

for na in netattrs:
    print(f"Name: {na.name}")

    # For each attribute assignment in the attribute assignments object:
    try:
        unas = na.assignments
        for una in unas:
            print(" -- Attribute Assignment Properties -- ")
            print(f"Utility Network Assignment Attribute ID: {una.networkAttributeId}")
            print(f"Utility Network Assignment Attribute Source Name: {una.networkSourceName} \n")
            # For each field evaluator in the attribute evaluator object:
            print(" - Field Evaluator Properties - ")
            fe = una.evaluator
            print(f"Field Evaluator Type: {fe.evaluatorType}")
            print(f"Field Evaluator Name: {fe.fieldName} \n")

    except:
        print(f"{na.name} does not have any attribute assignments \n")

在本主题中