Select to view content in your preferred language

Routing Exception

1467
0
03-03-2016 01:41 PM
GreggCountryman1
New Contributor

Hello,

I need to get a route and directions between two points on a map. I have created a Runtime Content that includes a Network Dataset. The route will solve without using directions, but when I set ReturnDirections to true, I get a message that the Directions Time Attribute is invalid.

Directions have been set up in the Network Dataset

Here is what the Directions tab looks like:

Directions Ready: Yes

General Directions:

Display Length Units: Miles

Length Attribute: Miles

Time Attribute: Seconds

Here is a code snippit:

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

LocalRouteTask routeTask;

routeTask = await Task.Run<LocalRouteTask>(() => new LocalRouteTask(runtimeGeodatabaseNetworkPath, "STREETS_ND"));

var routeParams = await routeTask.GetDefaultParametersAsync();

routeParams.OutSpatialReference = MyMapView.SpatialReference;

routeParams.DirectionsLengthUnit = LinearUnits.Miles;

routeParams.ReturnDirections = true;

// If I set ReturnDirections to false it works

//routeParams.ReturnDirections = false;

var stopGraphics = new List<Graphic>();

stopGraphics.Add(fromMapGraphic);

stopGraphics.Add(toMapGraphic);

routeParams.SetStops(stopGraphics);

//Exception happens on this line

var routeResult = await routeTask.SolveAsync(routeParams);

// Exception is : {"Invalid directions time attribute: '{0}'."}

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

Thanks,

Gregg

0 Kudos
0 Replies