Getting distance between 2 markers


I would like to get the distance between 2 markers but not as a direct line, more as a real path like it goes in this plugin -

<a href="https://github.com/perliedman/leaflet-routing-machine" rel="nofollow">https://github.com/perliedman/leaflet-routing-machine</a>

I didn't find anything about using this plugin in the directive: angular-leaflet-directive, if someone can guide how to make it done, it would be very appreciated.



I am not sure if you specifically want to use leaflet routing machine to get distances... but if you do, maybe this info can get you started:

Set up a route on your map based on this example by the leaflet routing machine author:

<a href="http://www.liedman.net/leaflet-routing-machine/interaction.html" rel="nofollow">http://www.liedman.net/leaflet-routing-machine/interaction.html</a>

If you look at that example, there is an array called routes. Each route has some basic statistics associated with it, generated by OSRM. You can pull them by calling for example:




Then you can do whatever you want with them. If you dig through the code on GitHub you can see more about how the data are moved around within the plugin and why the array is arranged that way:

<a href="https://github.com/perliedman/leaflet-routing-machine/blob/master/dist/leaflet-routing-machine.js" rel="nofollow">https://github.com/perliedman/leaflet-routing-machine/blob/master/dist/leaflet-routing-machine.js</a>


  • How can I force R to include contributors (or other roles) in my package's citation() output?
  • Automating Date Control using QTP
  • What is the difference between RO-Properties and TO-Properties in QTP?
  • Highcharts ; x-axis scaling issue
  • Mapbox Icons/Markers “BearingSnap” or Snap to Position
  • Replacing seconds since the epoch with ordered digits in R
  • URL detection adobe air desktop widget
  • What is the dash (“-”) when used with pipe (“|”) in CMD?
  • How to add a “using” statement to the System.Data.Entity namespace [closed]
  • How to make a user wait with Laravel
  • Where in the relevant specification is it documented that some comments in a SQL script are, in fact
  • Accessing 3rd level of JSON with Angular ng-repeat
  • Stitching 2 images (OpenCV)
  • Graceful pod termination
  • Generating anchors with PyYAML.dump()?
  • Slicing an SPA into several components and use AngularJS
  • to implement a spinner in angular2+
  • Get Currently Active User in Android
  • iOS Cordova first plugin - plugin.xml to inject a feature
  • Angular2 - Template reference inside NgSwitch
  • Set focus to first invalid form element in AngularJS
  • Graphics.CopyFromScreen [Web application] + The handle is invalid
  • ADO and msqli connections very slow
  • Custom Tabgroup Appcelerator
  • Use of this Javascript
  • Meteor helpers not available in Angular template
  • C++ Partial template specialization - design simplification
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • javaw.exe and eclipse startup problems
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • script to move all files from one location to another location
  • How to get next/previous record number?
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Confusion with PayPal's monthly billing cycle
  • Python: how to group similar lists together in a list of lists?
  • Running Map reduces the dimensions of the matrices
  • Android Heatmap on canvas or ImageView