最邻近属性

此 ArcGIS 3.0 文档已 存档,并且不再对其进行更新。 其中的内容和链接可能已过期。 请参阅最新文档

摘要

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

了解有关如何过滤所追踪内容的详细信息

属性

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

如果使用过滤器 nearest 函数,则这是用于计算成本的网络属性名称。 如果未使用过滤器 nearest 函数,此属性将返回一个空字符串。

String
count
(只读)

如果使用过滤器 nearest 函数,则这是将要返回要素数的值。 如果未使用过滤器 nearest 函数,则此属性将返回一个 -1 值。

Integer
nearestAssets
(只读)

nearestAssets 对象。 如果使用过滤器 nearest 函数,则这些是将要返回的资产组和资产类型。 如果未使用过滤器 nearest 函数,则此属性将返回一个空列表。

Object
nearestCategories
(只读)

如果使用过滤器 nearest 函数,则这些是将要返回的类别名称。 如果未使用过滤器 nearest 函数,则此属性将返回一个空列表。

String

代码示例

公共设施网络最近邻域和最近资产属性示例(独立脚本)

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

# Import required modules
import arcpy

# Describe functions on a Utility Network
UN = "C:\\Projects\\MyProject\\unowner.sde\\Naperville.UNOWNER.Naperville\\Naperville.UNOWNER.Naperville" 
d = arcpy.Describe(UN)

# Domain Network properties
domnets = d.domainNetworks

# For each domain network in the utility network
for dom in domnets:
    print(f"Domain Network Name: {dom.domainNetworkName}")
    
    # For each tier in the domain network
    for tier in dom.tiers:
        print(f"Tier Name: {tier.name}")
                
        # Update Subnetwork Trace Configuration Properties     
        ust = tier.updateSubnetworkTraceConfiguration

        # Nearest Neighbor Properties
        print(" - Nearest Neighbor Properties - ")
        nn = ust.nearestNeighbor
        # Try to get these properties if the exist, else, print the empty list
        try:
            print(f"Count: {nn.count}")
            print(f"Cost Network Attribute Name: {nn.costNetworkAttributeName}")
            print(f"Nearest Categories: {nn.nearestCategories} \n")
            print(f" - Nearest Asset Properties - ")
            for nsta in nn.nearestAssets:
                try:
                    print(f"Network Source ID: {nsta.networkSourceID}")
                    print(f"Asset Group Code: {nsta.assetGroupCode}")
                    print(f"Asset Type Code: {nsta.assetTypeCode} \n")
                except:
                    print("Skipped nearest assets properties. \n")
        except:
            print("Skipped nearest neighbor properties. \n")

在本主题中