ArcObjects Library Reference (NetworkAnalyst)  

INAServer.GetNALayerNames Method

Array of network analysis layers of a particular analysis type.

[Visual Basic .NET]
Public Function GetNALayerNames ( _
    ByVal layerType As esriNAServerLayerType _
) As String[]
[C#]
public String[] GetNALayerNames (
    esriNAServerLayerType layerType
);
[C++]
HRESULT GetNALayerNames(
  esriNAServerLayerType layerType,
  NALayerNames* NALayerNames
);
[C++]

Parameters

layerType [in]

  layerType is a parameter of type esriNAServerLayerType

NALayerNames [out, retval]   NALayerNames is a parameter of type

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Remarks

GetNALayerNames returns an array of names of NALayers of a given type.  For example, you could use this method to find the names of all of the route analysis layers in the default map of the map server.

[C#]

//Example to retrieve all route network analysis layers associated to a MapServer Objects:

 

//connect to the server and get access to the server context for the MapServer objects

ServerConnection conn = new ESRI.ArcGIS.Server.WebControls.ServerConnection("MyMachine",true);

IServerObjectManager pSOM = conn.ServerObjectManager;

IServerContext pServerContext = pSOM.CreateServerContext("MyMapServerObjects", "MapServer");

 

// Get access to the MapServer and NAServer Interfaces

IMapServer pMapServer = pServerContext.ServerObject as IMapServer;

IServerObjectExtensionManager soex = pMapServer as IServerObjectExtensionManager;

IServerObjectExtension sext = soex.FindExtensionByName("NAServer");

INAServer naServer = sext as INAServer;

 

// Retrieve the list of Routes NALayers for this MapServer objects

string[] naLayers = naServer.GetNALayerNames(ESRI.ArcGIS.NetworkAnalyst.esriNALayerType.esriNALayerRoute);

See Also

INAServer Interface