Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

122
Visualizações
How do i redirect to maps page with optimizeWaypoints configuration of maps API?

I'm using maps api in my app and when i what to see the created route i have the choice of set optimizeWaypoints = true to organize the waypoints but... I need to see that route on google maps page, but whenever i try that the way points are not "optimized".

I have done this that way:

for (var i = 0; i < wayptss.length; i++) {string_de_waypoints += wayptss[i] + '/';} var addresses = string_de_waypoints;

 var address2 = document.getElementById("end").value;

 // window.open("https://maps.google.ch/maps?saddr=["+address1+"]&daddr=["+address2+"] to:["+address3+"] to: ["+address4+"]to: ["+address5+"]")

        link_maps = "https://www.google.ch/maps/dir/"+address1+"/"+addresses+address2;
        window.open(link_maps)

The value come from here:

 const waypts = [];
        const checkboxArray = document.getElementById("waypoints");
        wayptss=[];
        for (let i = 0; i < checkboxArray.length; i++) {
            if (checkboxArray.options[i].selected) {
            waypts.push({
                location: checkboxArray[i].value,
                stopover: true,
            });
            //-----------------HERE--------------------------------
            wayptss.push(checkboxArray[i].value,
            );
            }

the input adresses staff

Well... What i want to know is, if I have some way to do that like exporting directly the route to google maps or something like that. Or if not at least a way to optimize the route waypoints array by getting his distance or something like that.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Ok i found a solution. I used this:

summaryPanel.innerHTML += route.legs[i].start_address + " to ";
summaryPanel.innerHTML += route.legs[i].end_address + "<br>";
summaryPanel.innerHTML += route.legs[i].distance.text + "<br><br>";

https://developers.google.com/maps/documentation/javascript/directions

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda