AnsweredAssumed Answered

divergence between map and Route plan

Question asked by frankiPL on May 3, 2018
Latest reply on May 23, 2018 by frankiPL
Hi

I'm working on a navigation app. I have noticed that sometimes there is a divergence between the map and Route plan. Clearly, you can see this in attached pictures, can someone shed some light why this is happening?

My QML code:

RouteTask {
            id: routeTaskOnline
            url: "http://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"
            Credential {
                oAuthClientInfo:oAuth
            }

            onLoadStatusChanged: {
                if (loadStatus === Enums.LoadStatusLoaded) {
                    console.log("Route task ready");
                    routeTaskOnline.createDefaultParameters();
                }
            }

            onCreateDefaultParametersStatusChanged: {
                if (createDefaultParametersStatus === Enums.TaskStatusCompleted) {
                    routeParameters = createDefaultParametersResult;
                    routeParameters.returnRoutes = true;
                    routeParameters.returnDirections = true;
                    routeParameters.directionsDistanceUnits=Enums.UnitSystemMetric;
                    routeParameters.directionsLanguage="PL"
                    routeParameters.travelMode.outputGeometryPrecision=1;
                    routeParameters.outputSpatialReference = SpatialReference.createWebMercator();
                }
            }

            onErrorChanged: {
                console.log("Route Error:", JSON.stringify(routeTaskOnline.error));
            }
            onSolveRouteStatusChanged: {
                if (solveRouteStatus === Enums.TaskStatusCompleted && solveRouteResult) {

                    for (var index = 0; index < solveRouteResult.routes.length; index++) {
                        console.log("add route graphics idx:"+index)
                        route = solveRouteResult.routes[index];
                        routeGraph = ArcGISRuntimeEnvironment.createObject("Graphic", {geometry: route.routeGeometry});
                        routeGraph.attributes.insertAttribute("route",1);
                        graphicsOverlay.graphics.append(routeGraph);
                        directionListModel = route.directionManeuvers;
                    }
                }
                else if (solveRouteStatus === Enums.TaskStatusErrored) {
                    console.log("Route error");
                }
            }
            Component.onCompleted: {
                routeTaskOnline.load();
            }
}

Pictures:

 

Best Regards

Marek

Outcomes