GetSolverProperties (arcpy.na)

摘要

根据指定为参数的网络分析图层类型返回网络分析求解程序属性对象。求解程序属性对象被用于更新图层的分析属性。

讨论

当修改网络分析图层的分析属性时,GetSolverProperties 用作主入口点。它根据网络分析图层返回单独的求解程序属性对象。有以下六种求解程序属性对象类型:RouteSolverPropertiesClosestFacilitySolverPropertiesServiceAreaSolverPropertiesODCostMatrixSolverPropertiesVehicleRoutingProblemSolverPropertiesLocationAllocationSolverProperties。每个求解程序属性对象都提供了对特定于某个网络分析图层的分析属性的读/写访问权限。

语法

GetSolverProperties (network_analyst_layer)
参数说明数据类型
network_analyst_layer

A variable that references a layer object obtained from a Network Analyst layer. It can be derived from existing layers in a map document or by specifying the catalog path to the Network Analyst layer file as an argument to the Layer class. The isNetworkAnalystLayer property on the layer object can be used to identify whether a given layer object is a Network Analyst layer.

Layer
返回值
数据类型说明
Object

与网络分析图层类型对应的求解程序属性对象。

代码实例

GetSolverProperties 示例

此示例显示了如何在地图文档中找到所有网络分析图层并更改其分析属性以使它们全部使用等级。它假定已将一些网络分析图层添加到地图文档中。

import arcpy

#Get a list of all the layers in the current map document
mxd = arcpy.mapping.MapDocument("CURRENT")
lyrs = arcpy.mapping.ListLayers(mxd)
#Filter the list to obtain only the network analyst layers
na_layers = [lyr for lyr in lyrs if lyr.isNetworkAnalystLayer]
#update the useHierarchy property
for na_layer in na_layers:
    na_solver_props = arcpy.na.GetSolverProperties(na_layer)
    na_solver_props.useHierarchy = True
5/10/2014