AnsweredAssumed Answered

NetworkAnalyst.LocalRouteTask  Exception "Cannot solve."

Question asked by laurita1988 on Apr 20, 2016
Latest reply on Mar 10, 2017 by marcoriveradev

I need some help, please

 

We are currently conducting a traceroute using a network dataset from a .net WPF application (.net sdk esri 10.2.5) and in some cases there is an exception that prevents generating the route. The validation was performed from the ArcMap and the route was generated correctly.

 

The parameters to generate the route are as follows:

 

  var routeParams2 = await routeLocalTask.GetDefaultParametersAsync();

                    routeParams2.ReturnDirections = true;

                    routeParams2.DirectionsLengthUnit = LinearUnits.Miles;

                    routeParams2.UseHierarchy = true;      

                    routeParams2.ReturnRoutes = true;

                    routeParams2.ReturnPolylineBarriers = true;

                    routeParams2.PreserveFirstStop = true;

                    routeParams2.PreserveLastStop = true;

                    routeParams2.FindBestSequence = true;

                    routeParams2.ImpedanceAttributeName = ListParameters.Find(X => X.ParameterId == "MAP_ROUIM" && X.Application == 1).Value;

                    var stopGraphics2 = new List<Graphic>();

                    stopGraphics2.Add(from);

                    stopGraphics2.Add(to);

                    routeParams2.SetStops(stopGraphics2);

                    routeParams2.OutSpatialReference = SpatialReference.Create(102100);

                    routeParams2.IgnoreInvalidLocations = true;

routeResultLocal = await routeLocalTask.SolveAsync(routeParams2);

 

Exception :

 

   at Esri.ArcGISRuntime.Tasks.NetworkAnalyst.LocalRouteTask.SolveMultipleRoutes(RouteParameters settings, Dictionary`2 groupsStopsByRouteName, CancellationToken cancellationToken)

   at Esri.ArcGISRuntime.Tasks.NetworkAnalyst.LocalRouteTask.<>c__DisplayClass7.<SolveAsyncInternal>b__6()

   at System.Threading.Tasks.Task`1.InnerInvoke()

   at System.Threading.Tasks.Task.Execute()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()

   at Esri.ArcGISRuntime.Tasks.NetworkAnalyst.LocalRouteTask.<SolveAsyncInternal>d__9.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

   at CADPresentationWPF.EsriMapNet.<AddRoutingToMap>d__476.MoveNext() in e:\Proyecto\RoutingPanel.cs:line 698

------------------------

 

But if I chage the value in this field "ReturnDirections" to false, I will get the geometry but I don't get the driving instructions

 

routeParams2.ReturnDirections = false;

routeResultLocal = await routeLocalTask.SolveAsync(routeParams2);

 

 

I will really appreciate if anyone can help me with this issue.

Outcomes