Connectivity Policies (arcpy)

Summary

Provides information about connectivity policies used by the edge sources and junction sources. 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

PropertyExplanationData 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 usesSubtypes property for a given edge source or junction source returns True, then this property should not be used to used to determine the connectivity policy. Instead, use the connPolicyX property for a particular subtype.

This property returns the following keywords for edge sources:

  • EndVertex
  • AnyVertex

This property returns the following keywords for junction sources:

  • Override
  • Honor
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 usesSubtypes property returns False, then this property returns 0.

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. connSubtypeX is a dynamic property that is supported only if the subTypeConnCount value is greater than 0.

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. connPolicyX is a dynamic property that is supported only if the subTypeConnCount value is greater than 0.

This property returns the following keywords for edge sources:

  • EndVertex
  • AnyVertex

This property returns the following keywords for junction sources:

  • Override
  • Honor
String
defaultGroup
(Read Only)

For edge sources only.

The connectivity group in which this edge feature source participates.

If the usesSubtypes property returns True, then this property returns -1. In such a case, use the groupNameX property for a particular subtype.

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 usesSubtypes property returns False, then this property returns 0.

Integer
groupSubtypeX
(Read Only)

For edge sources only.

The subtype code used to define the subtype for the given edge feature source.groupSubtypeX is a dynamic property that is supported only if the groupCount value is greater than 0.

Integer
groupNameX
(Read Only)

For edge sources only.

The connectivity group in which the particular subtype of the given edge feature source participates. groupNameX is a dynamic property that is supported only if the groupCount value is greater than 0.

String
defaultGroupsCount
(Read Only)

For junction sources only.

The total number of connectivity groups to which a given junction source belongs. If the usesSubtypes property returns True, then use the subtypeXGroupsCount property to determine the total number of connectivity groups to which a particular subtype of a given junction source belongs.

If the usesSubtypes property returns True, then this property returns 0.

Integer
defaultGroupNameX
(Read Only)

For junction sources only.

The connectivity group in which this junction feature source participates. defaultGroupNameX is a dynamic property that is supported only if the defaultGroupsCount value is greater than 0. The possible range of values for X depends on the defaultGroupsCount property.

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 usesSubtypes property returns False, then this property returns 0.

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. subtypeGroupX is a dynamic property that is supported only if the subtypeGroupCount value is greater than 0.

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. subtypeXGroupsCount is a dynamic property that is supported only if the subTypeGroupCount value is greater than 0.

Integer
subtypeXGroupNameX
(Read Only)

For junction sources only.

The connectivity group in which the particular subtype of the given edge feature source participates. groupNameX is a dynamic property that is supported only if the groupCount value is greater than 0.

String

Code Sample

Connectivity Policies Properties Example 1

Display connectivity policy information for edge sources in a nework 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(" ")
Connectivity Policies Properties Example 2

Display connectivity policy information for junction sources in a nework 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 (" ")
6/21/2013