3

I am developing an application that, to make a feature, I need to mark bus stops and trace the route to the bus.

I have all the stops in an array, each with its latitude and longitude. With the use of the google api I can do absolutely everything I wanted, the route is drawn correctly and passes through the respective points (stops), however have a limit .. If my career has more than 25 stops (waypoints), it is no longer possible to trace the route using waypoints.

Is there a solution to my problem?

/* Inicio e fim da rota */
    var start = busStopList[0].position;
    var end = busStopList[busStopList.length - 1].position;

    /* Array que vai armazenar todos os waypoints */
    var waypts = []
    
    busStopList.forEach(value => {
        /* Inserir no array um objeto com a localização da paragem */
        waypts.push({location: value.position})
    })
    
    /* Eliminar o primeiro e o ultimo item do array */
    waypts.splice(0, 1)
    waypts.splice(waypts.length - 1, 1)

    /* Configs do request */
    var request = {
        origin: start,
        destination: end,
        waypoints: waypts,
        optimizeWaypoints: true,
        travelMode: 'DRIVING'
    };

inserir a descrição da imagem aqui

0 Answers0