摘要
提供有关网络数据集中网络源的信息。 网络源可以有四种类型:边源、交汇点源、转弯源和系统交汇点源。 使用 sourceType 属性可标识网络源的类型。
基于网络源的类型,网络源对象可以支持特定于该源类型的附加属性。 边源和交汇点源支持附加属性以及网络源对象支持的属性。 转弯源和系统交汇点源不支持任何附加属性。
属性
属性 | 说明 | 数据类型 |
name (只读) | 与该网络源相关的要素类名称。 | String |
sourceID (只读) | 网络数据集内此网络源的唯一标识符。 | Integer |
sourceType (只读) |
网络源类型。 此属性返回以下关键字:
| String |
elementType (只读) |
网络源的网络元素类型。 此属性返回以下关键字:
| String |
代码示例
显示网络数据集中网络源的信息。
# Name: NDSNetworkSourceProperties_ex01.py
# Description: Print the information about the network sources for the
# network dataset
import arcpy
import sys
# Set workspace
arcpy.env.workspace = "C:/Data/SanFrancisco.gdb/Transportation"
#Create a Describe object from the network dataset
desc = arcpy.Describe("Streets_ND")
justify = 35
print("------- Network sources")
#Get all the network sources for the network dataset
sources = desc.sources
if not sources:
print("%*s" % (justify, "(No network sources)"))
sys.exit(0)
for source in sources:
print("%*s: %s" % (justify, "Source Name" , source.name))
print("%*s: %s" % (justify, "Source ID" , str(source.sourceID)))
print("%*s: %s" % (justify, "Source Type", source.sourceType))
print("%*s: %s" % (justify, "Element Type", source.elementType))
print(" ")