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

216
Visualizações
How can i calculate routes but not draw them on the map? Leaflet

i have been trying to get this working for quite some time now, but cyclic references from the routes objects, asynchronous execution and whatnot made it hard for me to see the bigger picture.

I am also new to this, as one might have guessed.

So i try to get the closest three parkhouses from a START. So i calculate the routes to extract the e.routes.summary.totalDistance from them. However, i do not want them to be shown in the map just yet, because i want the three closest parkhouses and not every single one. On the other hand, Leaflet Routing Machine does not calculate these routes if i do not route.addTo(map).

It is a really hard time with this because it does defy all basics i have learned until now. Can someone give me a hint how to do it?

            route = L.Routing.control({
                name: id,
                serviceUrl: 'http://router.project-osrm.org/route/v1',
                waypoints: coords,
                plan: L.Routing.plan(coords, {
                    createMarker: function() {
                        return null;
                    }
                }),
                addWaypoints: false,
                draggableWaypoints: false,
                show: false,
                showAlternatives: true
            }).on('routesfound', function(e) {
                for (let index = 0; index < e.routes.length; index++) {
                    tmpRoutes.push(e);
                    tmpDistances.push(e.routes[index].summary.totalDistance);
                    tmpWayPoints.push(e.routes[index].waypoints)
                }
                map.removeControl(e.routes);
            }).addTo(map);
            //map.removeControl(route);
        }
about 4 years ago · Santiago Gelvez
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