How to get the total km of route using Leaflet Routing Machine API?

المشرف العام

Administrator
طاقم الإدارة
I'm using machine leaflet route to draw routes I can get the total route miles? How can I do this?

I know the class IRouteSummary, but I am unable to access it. Just wanted an example so that I can access the returns of classes leaflet machine routeThis is my code:

L.Routing.control ({waypoints: [L.latLng (-30.050390, -51.198338) L.latLng (-30.024472, -51.219392) ] }) addTo (map).; var router = L.Routing.osrm () **** waypoints = [], **** line; map.on ('click', function (e) {**** waypoints.push ({latLng: e.latlng}); **** if (waypoints.length> = 2) {******** router.route (waypoints, function (err, routes) {************ if (line) {**************** map.removeLayer (line); ************ } ************ if (err) {**************** alert (err); ************ } Else {**************** line = L.Routing.line (routes [0]) addTo (map).; ************ } ******** }); **** } });

أكثر...
 
أعلى