Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda