DIRECTION API

The Directions API is a service that calculates directions between locations.


Parameters Required

Name Type Description
fm_token String Enter Flightmap token available in Flightmap dashboard
points Array of latlng Example : points:
points:'[{"lat":"30.72984395","lng":"76.7841456701605"},{"lat":"22.72046685","lng":"75.9060108"}]'
driving_mode string Driving mode is car.
waypoints Array of latlng Example :
waypoints:'[{"lat":"30.72984395","lng":"76.7841456701605"}]'
type String type can be Android, iOS or Web
traffic number Value can be 0 or 1.

Note: Units Time in Milliseconds and Distance in Meters.


Request

The following example requests the driving directions from one point to another.

https://maps.flightmap.io/api/directions?fm_token=<your api key here>&points=[{"lat":"30.7052918","lng":"76.8006199"},{"lat":"30.7363501","lng":"76.7823996"}]&driving_mode=car

Response

Description

Name Type Description
pathsArray of objectsComplete information of the direction
pointsStringEncoded polyline
instructionsArray of objectsStep by step instructions to the destination
ETA numericEstimate Time Arrival in minutes
ETA_textString Estimate Time Arrival in minutes

The Direction API returns following result in a JSON format.

Below is a sample response, in JSON:

{
    "message": "Successful",
    "status": 200,
    "data": {
      "hints": {
        "visited_nodes.average": "114.0",
        "visited_nodes.sum": "114"
      },
      "paths": [
        {
          "distance": 6113.987,
          "weight": 429.733145,
          "time": 429704,
          "transfers": 0,
          "points_encoded": true,
          "bbox": [
            76.779361,
            30.701915,
            76.801587,
            30.737288
          ],
          "points": "_`lzD{gwsMnDdCzCeDjFvDHTaB|AkRfRsGfHkAdA{Su`@[email protected]@QGU?u\\v\\[email protected]@[email protected][email protected]\\|Z]^[email protected]@Z}[[email protected]@[email protected]?NG^[email protected]?[[email protected]]dZQZKX?NG^EFYROBYCSOIMG[?MH][email protected]@wPi[[email protected]|G",
          "instructions": [
            {
              "distance": 234,
              "heading": 213.51,
              "sign": 0,
              "interval": [
                0,
                2
              ],
              "text": "Continue",
              "time": "42sec",
              "street_name": ""
            },
            {
              "distance": 157,
              "sign": 2,
              "interval": [
                2,
                3
              ],
              "text": "Turn right",
              "time": "18sec",
              "street_name": ""
            },
            {
              "distance": 12,
              "sign": 1,
              "interval": [
                3,
                4
              ],
              "text": "Turn slight right",
              "time": "1sec",
              "street_name": ""
            },
            {
              "distance": 732,
              "sign": 2,
              "interval": [
                4,
                7
              ],
              "text": "Turn right",
              "time": "52sec",
              "street_name": ""
            },
            {
              "distance": 54,
              "sign": 7,
              "interval": [
                7,
                8
              ],
              "text": "Keep right",
              "time": "3sec",
              "street_name": ""
            },
            {
              "distance": 635,
              "sign": 2,
              "interval": [
                8,
                9
              ],
              "text": "Turn right onto Purv Marg",
              "time": "38sec",
              "street_name": "Purv Marg"
            },
            {
              "distance": 814,
              "sign": -7,
              "interval": [
                9,
                15
              ],
              "text": "Keep left",
              "time": "49sec",
              "street_name": ""
            },
            {
              "exit_number": 2,
              "distance": 820,
              "sign": 6,
              "exited": true,
              "turn_angle": 4.07,
              "interval": [
                15,
                26
              ],
              "text": "At roundabout, take exit 2 onto Udyog Path",
              "time": "49sec",
              "street_name": "Udyog Path"
            },
            {
              "exit_number": 2,
              "distance": 830,
              "sign": 6,
              "exited": true,
              "turn_angle": 3.89,
              "interval": [
                26,
                37
              ],
              "text": "At roundabout, take exit 2 onto Udyog Path",
              "time": "49sec",
              "street_name": "Udyog Path"
            },
            {
              "exit_number": 2,
              "distance": 824,
              "sign": 6,
              "exited": true,
              "turn_angle": 4,
              "interval": [
                37,
                49
              ],
              "text": "At roundabout, take exit 2 onto Udyog Path",
              "time": "49sec",
              "street_name": "Udyog Path"
            },
            {
              "exit_number": 3,
              "distance": 702,
              "sign": 6,
              "exited": true,
              "turn_angle": 5.51,
              "interval": [
                49,
                63
              ],
              "text": "At roundabout, take exit 3 onto Himalaya Marg",
              "time": "42sec",
              "street_name": "Himalaya Marg"
            },
            {
              "distance": 68,
              "sign": -2,
              "interval": [
                63,
                64
              ],
              "text": "Turn left",
              "time": "8sec",
              "street_name": ""
            },
            {
              "distance": 2,
              "sign": -7,
              "interval": [
                64,
                65
              ],
              "text": "Keep left",
              "time": "0sec",
              "street_name": ""
            },
            {
              "distance": 54,
              "sign": -7,
              "interval": [
                65,
                67
              ],
              "text": "Keep left",
              "time": "3sec",
              "street_name": ""
            },
            {
              "distance": 169,
              "sign": -2,
              "interval": [
                67,
                68
              ],
              "text": "Turn left",
              "time": "20sec",
              "street_name": ""
            },
            {
              "distance": 0,
              "sign": 4,
              "last_heading": 234.0647184668439,
              "interval": [
                68,
                68
              ],
              "text": "Arrive at destination",
              "time": "0sec",
              "street_name": ""
            }
          ],
          "legs": [],
          "details": {},
          "ascend": 0,
          "descend": 0,
          "snapped_waypoints": "_`lzD{gwsMmdEbvB",
          "minutes": 7,
          "hours": 1,
          "ETA": 9,
          "ETA_text": "7 minutes"
        }
      ]
    }
  }

Let's find a way together

Get in touch to know about our Pricing Plans

Contact Us
Jungleworks