ArcObjects Library Reference (NetworkAnalyst)  

INAServer.Solve Method

Perform network analysis based on the input solve parameters.

[Visual Basic .NET]
Public Function Solve ( _
    ByVal NAServerSolverParams As INAServerSolverParams _
) As INAServerSolverResults
[C#]
public INAServerSolverResults Solve (
    INAServerSolverParams NAServerSolverParams
);
[C++]
HRESULT Solve(
  INAServerSolverParams* NAServerSolverParams,
  INAServerSolverResults** NASolverResults
);
[C++]

Parameters

NAServerSolverParams [in]

  NAServerSolverParams is a parameter of type INAServerSolverParams

NASolverResults [out, retval]

  NASolverResults is a parameter of type INAServerSolverResults

Product Availability

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

Remarks

Solve performs network analysis based on the NAServerSolverParams object (NAServerRouteParams, NAServerClosestFacilityParams, NAServerServiceAreaParams) that was passed in and returns it's output through an NAServerSolverResults object (NAServerRouteResults, NAServerClosestFacilityResults, NAServerServiceAreaParams).

[C#]

Example of code showing how to solve a route network analysis problem:

 

//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;

 

// Get the list of all route NALAyers for this MapServer objects

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

 

// Get access to the NASolversParameters for the first route NALayer

INAServerSolverParams solverParams = null;

if (naLayers.GetLength(0) >= 1)

     solverParams = naServer.GetSolverParameters(naLayers[0]) as  INAServerSolverParams;

 

// Solve and return the NAServerResults

if (solverParams != null)

     INAServerSolverResults solverResults = naServer.Solve(solverParams);

See Also

INAServer Interface