ThinkGeo.com    |     Documentation    |     Premium Support

Routing with multiple viapoints

Hello Team

Hope you are working, from home, and you are all in good health. We are only in a lockdown mode in our small island

I have an issue on routing. I noticed same issue on your sample application. kindly advise how to sort. the attached image explains clearly the problem. it’s about the straight line between the 1st and 2nd point

my codes

        PointShape startPoint = new PointShape(57.6538, -20.1305);
        PointShape endPoint = new PointShape(57.4283, -20.4254);
        List<PointShape> viaPoints = new List<PointShape>();
        for (int i = 0; i < lPoints.Count; i++)
        {
            Double lon = lPoints[i].lon;
            Double lat = lPoints[i].lat;
            PointShape myPoint = new PointShape(lon, lat);
            if (i == 0)
                startPoint = myPoint;
            else if (i == lPoints.Count - 1)
                endPoint = myPoint;
            else
                viaPoints.Add(myPoint);
        }

        // route shape
        RoutingEngine engine = new RoutingEngine(routeSource, shapeFileSource);
        engine.SearchRadiusInMeters = searchRadiusInMeters;
        RoutingResult rr = engine.GetRoute(startPoint, endPoint, viaPoints);
        return rr;

i tried RoutingResult rr = engine.GetRoute(startPoint, viaPoints); but that does not return any ShapeLines