back | source
How to find the distance between multiple locations
  1. displacement
    var marker1 = { lat: 13.686867, lon: 100.426157 };
    var marker2 = { lat: 13.712259, lon: 100.457989 };
    
    var distance = longdo.Util.distance([marker1, marker2]);
    *** Distance in metre

    Example

    More information: Documentation

  2. distance

    The following example requests the starting point and destination,in Web service:

    https://api.longdo.com/RouteService/json/route/guide?flon=100.426157&flat=13.686867&tlon=100.457989&tlat=13.712259&mode=t&type=25&locale=en&key=[YOUR_KEY_API]
    * Note! Make sure to replace [YOUR_KEY_API] with your API key

    Below is a calculate route response, in JSON:
    {
      "meta": {
        "from": {
          "lon": 100.426157,
          "lat": 13.686867
        },
        "to": {
          "lon": 100.457989,
          "lat": 13.712259
        },
        "config": "t25ennull"
      },
      "data": [
        {
          "fdistance": 1.784942,
          "tdistance": 27.394072,
          "id": 87863819,
          "interval": 400,
          "penalty": 30,
          "guide": [
            {
              "name": "Kallapraphruk Rd.",
              "turn": 4,
              "distance": 4474, //Section distance in meters
              "interval": 467
            },
            {
              "name": "Ratchaphruek Rd.",
              "turn": 2,
              "distance": 20, //Section distance in meters
              "interval": 1
            }
          ],
          "distance": 4494 //Distance in meters
        }
      ]
    }
    Example

    More information: if you want to know more about routing information,then you can use the Routing example to archive it