How to make route calculations work?

02-08-2017 02:44 AM
New Contributor


I have had this functionality to work perfectly.

But now recieve a 403 or 404 error whem I try to calculate the shortest driving distance for a firetruck to the fire in order to choose the most suitable toalarm.

I am using ArcGis onlie with the URLs:



"". please advice.

Btw. Is it possible to make the map calculate the route for a firetruck and not a nomal car? (not the same restriction in trafic..)

Kind regards

Thomas Gustafsson

0 Kudos
1 Reply
New Contributor

The exact error returned are e.g. this:

Find distance error:Error code '403':'User doesnot have permissions to access 'world/route.mapserver'.'

I get the errortext, but this has worked before.

My code is here:

      double totalMiles = 0;//double.MaxValue;
        MapPoint fromPoint = new MapPoint(fromLon, fromLat, SpatialReferences.Wgs84);
        MapPoint toPoint = new MapPoint(selected.lon,, SpatialReferences.Wgs84);
        var fromSym = new SimpleMarkerSymbol { Style = SimpleMarkerStyle.X, Size = 50, Color = Colors.Green };
        var toSym = new SimpleMarkerSymbol { Style = SimpleMarkerStyle.X, Size = 50, Color = Colors.GreenYellow };
        var fromMapGraphic = new Graphic { Geometry = fromPoint, Symbol = fromSym };getLayer("graphicsLayer").Graphics.Add(fromMapGraphic);
        var toMapGraphic = new Graphic { Geometry = toPoint, Symbol = toSym }; getLayer("graphicsLayer").Graphics.Add(toMapGraphic);
        //var uri = new Uri("");
        var uri = new Uri("");
        var routeTask = new OnlineRouteTask(uri);
        var routeParams = await routeTask.GetDefaultParametersAsync(); //MessageBox.Show(routeParams.ToString());
        routeParams.OutSpatialReference = ihmMapView.SpatialReference;
        routeParams.DirectionsLengthUnit = LinearUnits.Kilometers;
        routeParams.DirectionsLanguage = new System.Globalization.CultureInfo("EN");
        routeParams.ReturnDirections = true;
        routeParams.OutputLines = Esri.ArcGISRuntime.Tasks.NetworkAnalyst.OutputLine.Default;
        routeParams.FindBestSequence = true;

        var stopGraphics = new List<Graphic>();

        var routeResult = await routeTask.SolveAsync(routeParams);

I (and the Danish firetrucks) would really apreciate some help here.

0 Kudos