Connectivity Policies
Summary
Provides information about connectivity policies used by the edge sources and junction sources.
Discussion
The properties with a "X" in their names are dynamic properties. The possible values of "X" depend upon another property. For example, for a given edge source, connSubtypeX, and connPolicyX are dynamic properties where X indicates a particular subtype. The range of possible values for X depends on the subTypeConnCount property. So if an edge source has two subtypes, then it will support connSubtype0, connSubtype1, connPolicy0, and connPolicy1 properties.
Properties
| Name | Explanation | Data type |
|---|---|---|
|
usesSubtypes (Read only) |
For edge sources and junction sources. A Boolean indicating whether the given edge source or junction source determines connectivity groups and policies by subtypes. |
Boolean |
|
classConnectivity (Read only) |
For edge sources and junction sources. Indicates the policy determining how all edge elements in the given edge source or junction elements in the given junction source connect to each other. If the This property returns the following keywords for edge sources:
This property returns the following keywords for junction sources:
|
String |
|
subtypeConnCount (Read only) |
For edge sources and junction sources. The total number of subtypes that are used to define connectivity policies for the given edge source or junction source. If the |
Integer |
|
connSubtypeX (Read only) |
For edge sources and junction sources. The subtype code used to define the subtype for the given edge feature source or junction feature source. |
Integer |
|
connPolicyX (Read only) |
For edge sources and junction sources. Indicates the policy determining how all edge elements for a particular subtype in the given edge source connect to each other or how all junction elements for a particular subtype in the given junction source connect to each other. This property returns the following keywords for edge sources:
This property returns the following keywords for junction sources:
|
String |
|
defaultGroup (Read only) |
For edge sources only. The connectivity group in which this edge feature source participates. If the |
Integer |
|
groupCount (Read only) |
For edge sources only. The total number of subtypes that are used to define connectivity groups for the given edge source. If the |
Integer |
|
groupSubtypeX (Read only) |
For edge sources only. The subtype code used to define the subtype for the given edge feature source. |
Integer |
|
groupNameX (Read only) |
For edge sources only. The connectivity group in which the particular subtype of the given edge feature source participates. |
String |
|
defaultGroupsCount (Read only) |
For junction sources only. The total number of connectivity groups to which a given junction source belongs. If the If the |
Integer |
|
defaultGroupNameX (Read only) |
For junction sources only. The connectivity group in which this junction feature source participates. |
String |
|
subtypeGroupCount (Read only) |
For junction sources only. The total number of subtypes that are used to define connectivity groups for the given junction source. If the |
Integer |
|
subtypeGroupX (Read only) |
For junction sources only. The subtype code used to define the subtype (indicated by X) for the given junction feature source. |
Integer |
|
subtypeXGroupsCount (Read only) |
For junction sources only. The total number of connectivity groups to which a particular subtype (indicated by X) of a given junction source belongs. |
Integer |
|
subtypeXGroupNameX (Read only) |
For junction sources only. The name of the connectivity group in which the particular subtype (indicated by the first X) of the given junction source participates. |
String |
Code sample
Display connectivity policy information for edge sources in a network dataset.
# Name: NDSConnectivityPolicies_ex01.py
# Description: Prints out the connectivity policy information about the
# edge sources for a given network dataset
import arcpy
import sys
# Set workspace
arcpy.env.workspace = "C:/Data/Paris.gdb/Transportation"
#Create a Describe object from the network dataset
desc = arcpy.Describe("ParisMultimodal_ND")
justify = 35
print("------- Edge sources")
# Get all the edge sources for the network dataset
edgeSources = desc.edgeSources
#If there are no edge sources, quit
if not edgeSources:
print("%*s" % (justify, "(No edge sources)"))
sys.exit(0)
for edgeSource in edgeSources:
print(" %*s: %s" % (justify, "Source Name" , edgeSource.name))
print(" %*s: %s" % (justify, "Source ID" , str(edgeSource.sourceID)))
print(" %*s: %s" % (justify, "Source Type", edgeSource.sourceType))
print(" %*s: %s" % (justify, "Element Type", edgeSource.elementType))
print(" %*s: %s" % (justify, "From Elevation Field",
edgeSource.fromElevationFieldName))
print(" %*s: %s" % (justify, "To Elevation Field",
edgeSource.toElevationFieldName))
# Get connectivity information
conn = edgeSource.connectivityPolicies
# Check if subtypes are used for edge sources to define connectivity groups
#and policies
bUseSubtypes = conn.usesSubtypes
print(" %*s: %s" % (justify, "Connectivity defined by subtype?",
str(conn.usesSubtypes)))
#Print connectivity policy information depending on the use of subtypes
if not bUseSubtypes:
print("%*s: %s" %(justify,"Connectivity Policy",conn.classConnectivity))
else:
# Connectivity policy by subtype
print(" %*s: %s" % (justify, "Number of subtypes",
str(conn.subtypeConnCount)))
for i in range(0, conn.subtypeConnCount):
subtypeCode = getattr(conn, "connSubtype" + str(i))
policy = getattr(conn, "connPolicy" + str(i))
print(" %*s: %s" %(justify, "Subtype Code",subtypeCode))
print(" %*s: %s" % (justify, "... has connectivity policy", policy))
# Print connectivity Group information depending on the use of subtypes
if not bUseSubtypes:
print("%*s: %s" % (justify,"Belongs to Connectivity Group",
conn.defaultGroup))
else:
# Connectivity group by subtype
print(" %*s: %s" %(justify,"Number of subtypes for connectivity groups",
conn.groupCount))
for i in range(0, conn.groupCount):
subtypeCode = getattr(conn, "groupSubtype" + str(i))
name = getattr(conn, "groupName" + str(i))
print( "%*s: %s" %(justify,"Subtype Code", subtypeCode))
print("%*s: %s" %(justify,"... belongs to connectivity group",name))
print(" ")
Display connectivity policy information for junction sources in a network dataset.
# Name: NDSConnectivityPolicies_ex02.py
# Description: Prints out the connectivity policy information about the
# junction sources for a given network dataset
import arcpy
import sys
# Set workspace
arcpy.env.workspace = "C:/Data/Paris.gdb/Transportation"
#Create a Describe object from the network dataset
desc = arcpy.Describe("ParisMultimodal_ND")
justify = 35
print("------- Junction sources")
#Get all the junction sources for the network dataset
junctions = desc.junctionSources
#If there are no junction sources, quit
if not junctions:
print(" %*s" % (justify, "(No junction sources)"))
sys.exit(0)
for junction in junctions:
print(" %*s: %s" % (justify, "Source Name" , junction.name))
print(" %*s: %s" % (justify, "Source ID" , str(junction.sourceID)))
print(" %*s: %s" % (justify, "Source Type", junction.sourceType))
print(" %*s: %s" % (justify, "Element Type", junction.elementType))
print(" %*s: %s" % (justify, "Elevation Field",
junction.elevationFieldName))
# system junctions do not support connectivity information
sourcetype = junction.sourceType
if sourcetype.lower() != "junctionfeature":
continue
#Get the connectivity policies
conn = junction.connectivityPolicies
if not conn:
continue
# Connectivity can be defined based on subtypes
bUseSubtypes = conn.usesSubtypes
print(" %*s: %s" % (justify + 5, "Connectivity defined by subtype?" ,
str(conn.usesSubtypes)))
if not bUseSubtypes:
print(" %*s: %s" % (justify + 5, "Connectivity policy" ,
conn.classConnectivity))
outtext = "Belongs to %d different connectivity groups" % conn.defaultGroupsCount
print(" %*s" % (justify + 5, outtext))
defgrouplist = []
for i in range(0,conn.defaultGroupsCount):
defgrouplist.append(str(getattr(conn, "defaultGroupName" + str(i))))
print("%*s: %s" % (justify + 5,"... belongs to connectivity group(s)",
" ".join(defgrouplist)))
else:
print(" %*s: %s" % (justify + 5, "Number of subtypes" ,
str(conn.subtypeConnCount)))
for i in range(0, conn.subtypeConnCount):
st = getattr(conn, "connSubtype" + str(i))
policy = getattr(conn,"connPolicy" + str(i))
print(" ")
print(" %*s: %s" % (justify + 10, "Subtype value" , st))
print(" %*s: %s" % (justify + 10, "...has connectivity policy" ,
policy))
print("")
for i in range(0, conn.subtypeGroupCount):
stGroup = getattr(conn, "subtypeGroup" + str(i))
print(" %*s: %d" % (justify + 10, "Subtype value", stGroup))
count = getattr(conn, "subtype" + str(i) + "GroupsCount")
grouplist = []
for j in range(0, count):
key = getattr(conn,"subtype%dGroupName%d" % (i,j))
grouplist.append(str(key))
print(" %*s %s" % (justify + 10, "...belongs to connectivity group(s)",
" ".join(grouplist)))
print("")
print(" ")