Network Attributes (arcpy)
摘要
提供有关为指定网络数据集定义的网络特性的信息。
讨论
对于特定的网络特性,edgeDirectionX、sourceNameX、evaluatorTypeX 和 dataX 为动态属性,其中 X 表示特定赋值器。X 值的允许范围取决于 evaluatorCount 属性。例如,如果名为 DriveTime 的网络特性含有两个赋值器(evaluatorCount 属性所指定),则 DriveTime 特性将支持 edgeDirection0、sourceName0、evaluatorType0、data0、edgeDirection1、sourceName1、evaluatorType1 和 data1 属性。
类似地,对于特定的网络特性,parameterNameX、parameterTypeX 和 parameterDefaultValueX 为动态属性,其中 X 表示特定的参数。X 值的允许范围取决于 parameterCount 属性。例如,如果名为 DriveTime 的网络特性含有两个参数(parameterCount 属性所指定),则 DriveTime 特性将支持 parameterName0、parameterType0、parameterDefaultValue0、parameterName1、parameterType1 和 parameterDefaultValue1 属性。
属性
属性 | 说明 | 数据类型 |
name (只读) |
The name of the network attribute. | String |
units (只读) |
The units for the network attribute. Units of a cost attribute are either distance or time units, for example, centimeters, meters, miles, minutes, seconds. Descriptors, hierarchies, and restrictions have unknown units. | String |
usageType (只读) |
The network attribute usage type. This property returns the following keywords:
| String |
dataType (只读) |
The network attribute data type. This property returns the following keywords:
| String |
useByDefault (只读) |
Indicates if the network attribute is used by default on a newly created network analysis layer. Only one cost attribute in the network dataset can be set to be used by default. Descriptor attributes cannot be used by default. | Boolean |
defaultEdgeEvaluatorType (只读) |
The default edge evaluator type used by the network dataset. This property returns the following keywords:
This property is not supported with SDC-based network datasets. | String |
defaultEdgeData (只读) |
The value for the network attribute that is associated by default with all the edge network sources in the network dataset. In case of a script evaluator the entire expression is returned. The data type of the returned value depends upon the data type and the default edge evaluator type associated with the network attribute. This property is not supported with SDC-based network datasets. | Variant |
defaultJunctionEvaluatorType (只读) |
The default junction evaluator type used by the network dataset. This property returns the following keywords:
This property is not supported with SDC-based network datasets. | String |
defaultJunctionData (只读) |
The value for the network attribute that is associated by default with all the junction network sources in the network dataset. In case of a script evaluator the entire expression is returned. The data type of the returned value depends upon the data type and the default junction evaluator type associated with the network attribute. This property is not supported with SDC-based network datasets. | Variant |
defaultTurnEvaluatorType (只读) |
The network dataset default turn evaluator type. The property is available only if the network dataset supports turns that can be determined using the supportsTurns property. This property returns the following keywords:
This property is not supported with SDC-based network datasets. | String |
defaultTurnData (只读) |
The value for the network attribute that is associated by default with all the turn network sources in the network dataset. In case of a script evaluator the entire expression is returned. The property is available only if the network dataset supports turns that can be determined using the supportsTurns property. The data type of the returned value depends upon the data type and the default turn evaluator type associated with the network attribute. This property is not supported with SDC-based network datasets. | Variant |
evaluatorCount (只读) |
The total number of evaluators used to derive values from the given network source for this network attribute. This property is not supported with SDC-based network datasets. | Integer |
edgeDirectionX (只读) |
The direction for the edge network sources along which the evaluator assigns the value for the network attribute. There is no direction associated with junction and turn network sources. edgeDirectionX is a dynamic property. This property returns the following keywords:
This property is not supported with SDC-based network datasets. | String |
sourceNameX (只读) |
The name of the network source for which the evaluator calculates the value of a given network attribute. sourceNameX is a dynamic property. This property is not supported with SDC-based network datasets. | String |
evaluatorTypeX (只读) |
The type of evaluator. evaluatorTypeX is a dynamic property. This property returns the following keywords.
This property is not supported with SDC-based network datasets. | String |
dataX (只读) |
The value of the network attribute assigned to a network source using the evaluator. In case of a script evaluator the entire expression is returned. The data type of the returned value depends upon the data type and the evaluator type associated with the network attribute. dataX is a dynamic property. This property is not supported with SDC-based network datasets. | Variant |
parameterCount (只读) |
The total number of attribute parameters defined for the network attribute. | Integer |
parameterNameX (只读) |
The name of the parameter. parameterNameX is a dynamic property that is supported only if parameterCount value is greater than 0. | String |
parameterTypeX (只读) |
The data type for the parameter. parameterTypeX is a dynamic property that is supported only if parameterCount value is greater than 0. This property returns the following keywords
| String |
parameterDefaultValueX (只读) |
The default value for the parameter. parameterDefaultValueX is a dynamic property that is supported only if parameterCount value is greater than 0. The data type of the returned value depends upon the data type of the attribute parameter. | Variant |
parameterUsageTypeX (只读) | The usage type for the parameter. This property returns the following keywords:
parameterUsageTypeX is a dynamic property that is supported only if parameterCount value is greater than 0. | String |
代码实例
显示网络数据集的网络特性信息。
# Name: NDSAttributeProperties_ex01.py
# Description: Print the information about network attributes defined for the
# network dataset
import arcpy
# Set workspace
arcpy.env.workspace = "C:/Data/Paris.gdb/Transportation"
# Create a Describe object from the network dataset
desc = arcpy.Describe("ParisMultimodal_ND")
# Get a list of network attributes
attributes = desc.attributes
#print information for each attribute
for attribute in attributes:
print "----------------------------------\n"
print "Name: ", attribute.name
print "Units: ", attribute.units
print "Usage Type: ", attribute.usageType
print "Data Type: ", attribute.dataType
print "Use By Default: ", str(attribute.useByDefault)
#Information about default evaluators
print "Default edge evaluator type: ", attribute.defaultEdgeEvaluatorType
print "Default edge evaluator data: ", str(attribute.defaultEdgeData)
print "Default junction evaluator type: ",attribute.defaultJunctionEvaluatorType
print "Default junction evaluator data: ",str(attribute.defaultJunctionData)
#Turn specific information is supported only if network dataset supports
#turns
if desc.supportsTurns:
print "Default turn evaluator type: ",attribute.defaultTurnEvaluatorType
print "Default turn evaluator data: ", str(attribute.defaultTurnData)
#Describe all other evaluators
count = attribute.evaluatorCount
print "Evaluator count: " , count
for i in range(0, count):
text = "Evaluator %d" % i
print text, " ---"
edgeDir = getattr(attribute,"edgeDirection" + str(i))
print "Edge direction: ", edgeDir
srcName = getattr(attribute,"sourceName" + str(i))
print "Source Name: ", srcName
evaluatortype = getattr(attribute,"evaluatorType" + str(i))
evaluatordata = getattr(attribute,"data" + str(i))
print "Evaluator Type: ", evaluatortype
print "Evaluator Data: ", evaluatordata
#Describe attribute parameters
print "Parameter Information........"
paramcount = attribute.parameterCount
if paramcount == 0:
print "No Parameters defined."
else:
print "Parameter Count: " , paramcount
for i in range (0, paramcount):
paramName = getattr(attribute, "parameterName" + str(i))
paramType = getattr(attribute, "parameterType" + str(i))
paramDefaultValue = getattr(attribute, "parameterDefaultValue" + str(i))
print "Parameter Name: " , paramName
print "Parameter Type: " , paramType
print "Parameter Default Value: ", paramDefaultValue