GetSolverProperties (arcpy.na)

Resumen

Returns a ArcGIS 10.1 Network Analyst solver properties object based on the type of the ArcGIS 10.1 Network Analyst layer specified as the argument. The solver properties object is used to update the analysis properties for the layer.

Debate

GetSolverProperties acts as the main entry point when modifying the analysis properties of a ArcGIS 10.1 Network Analyst layer. It returns a separate solver properties object based on the ArcGIS 10.1 Network Analyst layer. There are six types of solver properties objects: RouteSolverProperties, ClosestFacilitySolverProperties, ServiceAreaSolverProperties, ODCostMatrixSolverProperties, VehicleRoutingProblemSolverProperties, and LocationAllocationSolverProperties. Each solver properties object provides read/write access to the analysis properties specific to a ArcGIS 10.1 Network Analyst layer.

Sintaxis

GetSolverProperties (network_analyst_layer)
ParámetroExplicaciónTipo de datos
network_analyst_layer

A variable that references a layer object obtained from a ArcGIS 10.1 Network Analyst layer. It can be derived from existing layers in a map document or by specifying the catalog path to the ArcGIS 10.1 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 ArcGIS 10.1 Network Analyst layer.

Layer
Valor de retorno
Tipo de datosExplicación
Object

A solver properties object corresponding to the type of the ArcGIS 10.1 Network Analyst layer.

Ejemplo de código

GetSolverProperties example

This example shows how to find all ArcGIS 10.1 Network Analyst layers in a map document and change their analysis properties such that they all use hierarchy. It assumes that some ArcGIS 10.1 Network Analyst layers are already added to a map document.

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
9/11/2013