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

211
Vistas
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 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