ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Aide
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plateforme cartographique de votre organisation

ArcGIS Desktop

Un SIG professionnel complet

ArcGIS Enterprise

SIG dans votre entreprise

ArcGIS for Developers

Outils de création d'applications de localisation

ArcGIS Solutions

Modèles d'applications et de cartes gratuits pour votre secteur d'activité

ArcGIS Marketplace

Téléchargez des applications et des données pour votre organisation.

  • Documentation
  • Support
Esri
  • Se connecter
user
  • Mon profil
  • Déconnexion

ArcMap

  • Accueil
  • Commencer
  • Carte
  • Analyser
  • Gérer les données
  • Outils
  • Extensions

GetNAClassNames

  • Résumé
  • Discussion
  • Syntaxe
  • Exemple de code

Résumé

Returns a dictionary of network analysis class names from the network analysis layer specified as argument. The dictionary keys are the network analysis class names, and the values are the layer names that reference the network analysis classes from the network analysis layer. The layer names are used as input in some geoprocessing tools such as Add Locations and Add Field To Analysis Layer.

Discussion

A network analysis layer is made up of one or more network analysis classes. Each network analysis class is a feature layer or a table view that references a feature class or a table. This function returns a mapping between those feature class or table names and their corresponding feature layer or table view names. The layer names are not constants, as they can be edited by an end user or can be localized by a foreign language version of ArcGIS. This function helps to write portable script code that runs across different ArcGIS language versions. The dictionary keys always remain constant and can be used to obtain the variable layer name for a given network analysis class.

Network analysis classes have various characteristics depending on the network analysis layer. Some of the classes are used to store inputs that are used during analysis, while some are used to store the outputs obtained from solving the analysis layer. The classes can also have location fields or location ranges if they act as network locations and have different shape types such as points, lines, or polygons or no shapes (in other words, tables). The naclass_edit_type, nalocation_type, and shape_type arguments can be used to further filter the list of network analysis classes. For example, the Sub Layer parameter in the Add Locations tool lists only those network analysis classes that support input edit mode, so such a list can be obtained by using INPUT as the value for the naclass_edit_type argument.

Syntaxe

GetNAClassNames (network_analyst_layer, {naclass_edit_type}, {nalocation_type}, {shape_type})
ParamètreExplicationType de données
network_analyst_layer

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

Layer
naclass_edit_type

A string that specifies which network analysis classes are included in the output dictionary based on their edit mode in the network analysis layer. The argument value can be one of the following string keywords:

  • ANY —Include all the classes from the network analysis layer. This is the default value.
  • INPUT —Include only those classes that support an input mode in the network analysis layer. This option will also include classes that support both input and output modes.
  • OUTPUT —Include only those classes that support an output mode in the network analysis layer. This option will also include classes that support both input and output modes.

(La valeur par défaut est ANY)

String
nalocation_type

A string that specifies which network analysis classes are included in the output dictionary based on their support for location fields. The argument value can be one of the following string keywords:

  • ANY —Include the classes from the network analysis layer irrespective of whether they do or do not support location fields. This is the default value.
  • LOCATION —Include only those classes from the network analysis layer that support location fields or location ranges.
  • NOT_LOCATION —Include only those classes from the network analysis layer that do not support location fields or location ranges.

(La valeur par défaut est ANY)

String
shape_type

A string that specifies which network analysis classes are included in the output dictionary based on their shape type. The argument value can be one of the following string keywords:

  • ANY —Include all shape type classes from the network analysis layer. This is the default value.
  • POINT —Include only point classes from the network analysis layer.
  • LINE —Include only line classes from the network analysis layer.
  • POLYGON —Include only polygon classes from the network analysis layer.
  • NULL —Include only tables from the network analysis layer.

(La valeur par défaut est ANY)

String

Valeur renvoyée

Type de donnéesExplication
Dictionary

A dictionary whose keys are the network analysis class names and values are the layer names that reference the network analysis classes from the network analysis layer.

Exemple de code

GetNAClassNames example (workflow)

This example shows how to generate one-, two-, and three-minute service area polygons around fire stations and export the service areas as a feature class in a geodatabase. It illustrates how the GetNAClassNames function can be used to derive values that can be used as input for other ArcPy functions.

import arcpy

#Set up the environment
arcpy.env.overwriteOutput = True
arcpy.CheckOutExtension("network")

#Set up variables
networkDataset = "C:/Data/SanFrancisco.gdb/Transportation/Streets_ND"
facilities = "C:/Data/SanFrancisco.gdb/Analysis/FireStations"
outputPolygons = "C:/Data/SanFrancisco.gdb/FireStationServiceAreas"

#Make a new service area layer
serviceAreaLayer = arcpy.na.MakeServiceAreaLayer(networkDataset, "FireStationServiceAreas",
                                                 "TravelTime", "TRAVEL_FROM",
                                                 "1 2 3").getOutput(0)

#Get the network analysis class names from the service area layer
naClasses = arcpy.na.GetNAClassNames(serviceAreaLayer)

#Load fire stations as facilities
arcpy.na.AddLocations(serviceAreaLayer, naClasses["Facilities"], facilities)

#Solve the service area layer
arcpy.na.Solve(serviceAreaLayer)

#Get the polygons sublayer from the service area layer
polygonsSublayer = arcpy.mapping.ListLayers(serviceAreaLayer,
                                            naClasses["SAPolygons"])[0]

#Export the polygons sublayer as a feature class
arcpy.management.CopyFeatures(polygonsSublayer, outputPolygons)

arcpy.AddMessage("Completed")

Rubriques connexes

  • Présentation des classes d'analyse de réseau

ArcGIS Desktop

  • Accueil
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

A propos d'Esri

  • A propos de la société
  • Carrières
  • Blog des initiés
  • Conférence des utilisateurs
  • Sommet des développeurs
Esri
Donnez-nous votre avis.
Copyright © 2018 Esri. | Confidentialité | Légal