Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
máquina de enrutamiento de folletos - IRoute.summary.totalDistance

Estoy usando Leaflet 1.2.0 y Leaflet Routing Machine 3.2.12.

Mi código está dibujando la ruta correcta en el mapa, sin embargo, cuando quiero acceder al resumen y a la Distancia total del resumen, ambos están indefinidos. ¿Porqué es eso?

 function createRoute(id, coords) { route = L.Routing.control({ name: id, serviceUrl: 'http://router.project-osrm.org/route/v1', //router: L.Routing.graphHopper('apiKey'); waypoints: coords, //way_points, addWaypoints: false, draggableWaypoints: false, show: false, }).on('routesfound', function(e) { console.log(this.summary.totalDistance); // console.log(route.summary.totalDistance); }) //.on('routesfound', function(e) { // routes = e.routes; //is declared and instantiated before the function // // createRoute // RouteLength = routes[0].summary.totalDistance; //}); .addTo(map); }

El error: Error de enrutamiento: estado -3 TypeError: No se pueden leer las propiedades de undefined (leyendo 'totalDistance').

Desde la consola obtengo la escalada de:

 fire @ leaflet.js:5 (anonym) @ leaflet-routing-machine.js:16166 (anonym) @ leaflet-routing-machine.js:18004 loaded @ leaflet-routing-machine.js:46 load (asynchron) corslite @ leaflet-routing-machine.js:53 route @ leaflet-routing-machine.js:17977 route @ leaflet-routing-machine.js:16151 onAdd @ leaflet-routing-machine.js:15919 addTo @ leaflet.js:5 createRoute @ POI-Dash implement Routing.html:586

¿Alguien sabe más al respecto?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

this no tiene summary Deberá e.routes , como e.routes[0].summary.totalDistance .

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!