Network Analyst layer properties

サマリー

The Describe function returns the properties described below for Network Analyst layers.

For a Network Analyst layer, the dataType property of the Describe function returns a value of "NALayer".

A Network Analyst layer contains information about the inputs and parameters used in the analysis of a network problem using the Network Analyst extension.

プロパティ

プロパティ説明データ タイプ
network
(読み取り専用)

The Network Dataset object.

This object can be used to get all the properties, such as catalogPath, of the underlying network dataset used by the analysis layer.

Object
nameString
(読み取り専用)

The name of the Network Analyst layer.

String
solverName
(読み取り専用)

The Network Analyst solver referenced by the layer. Each layer can reference only one solver. This property returns the following keywords:

  • Closest Facility Solver
  • Last Mile Delivery Solver
  • Location-Allocation Solver
  • OD Cost Matrix Solver
  • Route Solver
  • Service Area Solver
  • Vehicle Routing Problem Solver

String
impedance
(読み取り専用)

The network cost attribute used as the impedance during the analysis.

String
accumulators
(読み取り専用)

A semicolon-separated list of network cost attributes that are accumulated as part of the analysis.

String
restrictions
(読み取り専用)

A semicolon-separated list of restriction attributes that are applied for the analysis.

String
ignoreInvalidLocations
(読み取り専用)

Specifies whether invalid network locations within the Network Analyst classes are ignored by the solver.

A value of True indicates that the invalid locations are ignored by the solver. A value of False indicates that the invalid locations are not ignored by the solver.

Boolean
uTurns
(読み取り専用)

Indicates how the U-turns at junctions, which could occur during network traversal between stops, are handled by the solver. This property returns the following keywords:

  • ALLOW_UTURNS
  • NO_UTURNS
  • ALLOW_DEAD_ENDS_ONLY
  • ALLOW_DEAD_ENDS_AND_INTERSECTIONS_ONLY

String
useHierarchy
(読み取り専用)

Indicates whether the Network Analyst layer is using hierarchy. This property returns the following keywords:

  • USE_HIERARCHY
  • NO_HIERARCHY

String
hierarchyAttribute
(読み取り専用)

The name of the hierarchy attribute.

String
hierarchyLevelCount
(読み取り専用)

The number of hierarchy ranges used to define the hierarchy attribute. The maximum value is 3.

Integer
maxValueForHierarchyX
(読み取り専用)

A given hierarchy attribute can have values that define the hierarchy ranges. The maximum values for each range can be obtained from the maxValueForHierarchyX property, where X indicates the hierarchy level. For example, the maximum value for the first hierarchy range (used to define the primary roads) can be obtained from the maxValueForHierarchy1 property.

Use the hierarchyLevelCount property to determine the possible number of maxValueForHierarchy properties for a given hierarchy attribute. For example, if the hierarchyLevelCount property returns 3, the Describe object will support the MaxValueForHierarchy1 and MaxValueForHierarchy2 properties.

Integer
locatorCount
(読み取り専用)

The total number of classes that are searched to determine a network location.

Integer
locators
(読み取り専用)

The Network Analyst Locator object. This object can be used to obtain the name, snap type, and search query information for the classes that are used for finding network locations.

Object
findClosest
(読み取り専用)

Indicates how the network source features are searched when locating network analysis objects. This property returns the following keywords:

  • MATCH_TO_CLOSEST
  • PRIORITY

String
searchTolerance
(読み取り専用)

A space-separated string indicating the search tolerance and the units used when finding the network locations.

String
excludeRestrictedElements
(読み取り専用)

Indicates whether the network analysis objects can be located only on traversable portions of network sources This property returns the following keywords:

  • INCLUDE
  • EXCLUDE

String
solverProperties
(読み取り専用)

The Network Analyst Solver object. This object can be used to determine the solver-specific properties in a Network Analyst layer.

注意:
Last mile delivery analysis layers do not have this property.

Object
children
(読み取り専用)

Returns a list of Describe objects that reference individual network analysis classes (such as stops and routes) as layers.

This property cannot be used with the network analysis layer stored on disk as a layer file.

List
parameterCount
(読み取り専用)

The total number of attribute parameters defined for all the network attributes of the underlying network dataset used by the Network Analyst layer.

Integer
parameters
(読み取り専用)

The Network Attribute Parameter object. This object can be used to determine the attribute parameters for the network analysis.

Object

コードのサンプル

Network Analyst layer properties example

Display properties of a specified Network Analyst layer file.

# Name: NALayerProperties_ex01.py
# Description: Lists all the properties that can be derived by describing a 
#              network analysis layer.

import arcpy

#Arguments..
#in_layer is the name of the Network Analysis layer file to be described.  
in_layer = "C:/Data/Route.lyr"  

#Get the description object using Describe. 
desc = arcpy.Describe(in_layer) 

arcpy.AddMessage(" ")
arcpy.AddMessage("== Description of network analysis layer " + in_layer + " ==")
arcpy.AddMessage(" ") 

#Print general infomation.
justify = 35 
nds = desc.network 
solvername = desc.solverName 
arcpy.AddMessage("---- General information:") 
arcpy.AddMessage(" %*s: %s" % (justify, "Network" , nds.catalogPath)) 
arcpy.AddMessage(" %*s: %s" % (justify, "SolverName" , desc.solverName)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Impedance" , desc.impedance)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Accumulators" , desc.accumulators)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Restrictions" , desc.restrictions)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Ignore invalid locations?" , 
                str(desc.ignoreInvalidLocations))) 
arcpy.AddMessage(" %*s: %s" % (justify, "UTurn policy" , desc.UTurns)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Using hierarchy?" , desc.useHierarchy))
arcpy.AddMessage(" %*s: %s" % (justify, "Exclude Restricted Elements?" ,
                               desc.excludeRestrictedElements))
arcpy.AddMessage(" ") 

#A note about the dynamic properties (indicated by X in the help system)
#In order to access the dynamic properties use Python's built in getattr()
#function. In order to find out if a dynamic property is supported by the 
#describe object, use Python's built in hasattr() function. 

# Print attribute parameter information
arcpy.AddMessage(" ---- Attribute Parameter information ----") 
count = desc.parameterCount 
if count == 0: 
    arcpy.AddMessage(" ---- No Attribute Parameters defined ----") 
else: 
    parameters = desc.parameters 
    for i in range(0, count): 
        attributeName = getattr(parameters,"attributeName" + str(i)) 
        parameterName = getattr(parameters, "parameterName" + str(i)) 
        parameterValue = getattr(parameters, "parameterValue" + str(i)) 
        arcpy.AddMessage(" %*s: %s: %s" % (justify, attributeName, 
                                           parameterName, parameterValue))   

# Print hierarchy information
if desc.useHierarchy.lower() == "use_hierarchy": 
    arcpy.AddMessage(" ---- Hierarchy information ----")
    arcpy.AddMessage(" %*s: %s" % (justify, "Hierarchy Attribute Name",
                                   desc.hierarchyAttribute)) 
    count = desc.hierarchyLevelCount
    arcpy.AddMessage(" %*s: %d" % (justify, "Hierarchy Level Count" , count)) 
    
    for i in range(0, count ): 
        levelRange = "" 
        if i == 0:      
            levelUB = getattr(desc,"maxValueForHierarchy" + str(i+1))            
            levelRange = "up to %s" % levelUB 
        elif i == (count - 1): 
            prevLevelUB = getattr(desc, "maxValueForHierarchy" + str(i)) 
            levelRange = "%s and higher" % (prevLevelUB + 1)
        else: 
            prevLevelUB =  getattr(desc, "maxValueForHierarchy" + str(i)) 
            levelUB = getattr(desc,"maxValueForHierarchy" + str(i + 1)) 
            levelRange = "%s - %s" % ((prevLevelUB + 1), levelUB)
        
        arcpy.AddMessage(" %*s %d range: %s" % (justify, "level", (i + 1), 
                                                levelRange))

    arcpy.AddMessage(" ") 

# Print locator information. 
arcpy.AddMessage("---- Locator information:") 
count = desc.locatorCount 
arcpy.AddMessage(" %*s: %d" % (justify, "Count" , count)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Find Closest?" , desc.findClosest)) 
arcpy.AddMessage(" %*s: %s" % (justify, "Search Tolerance", 
                               desc.searchTolerance))
arcpy.AddMessage(" %*s: %s" % (justify, "Exclude Restricted Elements",
                               desc.excludeRestrictedElements))
locators = desc.locators 
for i in range(0, count): 
    sourceName = getattr(locators, "source" + str(i)) 
    sourceType = getattr(locators, "snapType" + str(i))
    searchQuery = getattr(locators, "searchQuery" + str(i))
    arcpy.AddMessage(" %*s: %s" %(justify, sourceName, sourceType))
    arcpy.AddMessage(" %*s: %s" %(justify, sourceName, searchQuery))