Direction API

Direction API

The Directions API is a service that accepts an HTTP request and returns JSON formatted directions between locations.

It allows developers to integrate navigation, and driving directions into their applications. The API returns detailed step by step instructions between two or more locations.

Api Features: 

  1. Providing directions between two or multiple points.
  2. Provides detailed turn-by-turn instructions.
  3. Includes encoded polylines for displaying routes on maps.

How to use the Directions API:

Parameter Required:-

 

Name Type Description
fm_token String Enter Mappr token available in Mappr dashboard
points Array of latitude and longitude Example:-

points:'[{“lat”:”30.72984395″,”lng”:”76.7841456701605″},{“lat”:”22.72046685″,”lng”:”75.9060108″}]’

driving_mode String Driving mode is car.
waypoints Array of latitude and longitude Example :

waypoints:'[{“lat”:”30.72984395″,”lng”:”76.7841456701605″}]’

type(Optional) String type can be Android, iOS or Web

 

Request:
The following example requests show the best possible directions between two places.

 

https://maps.flightmap.io/api/directions?fm_token=< your mappr fm token >&points [{“lat”:”30.72984395″,”lng”:”76.7841456701605″},{“lat”:”22.72046685″,”lng”:”75.9060108″}]&driving_mode=car&waypoints [{“lat”:”30.703188750835995″,”lng”:”76.85043189419744″}]

 

Response:

Name Type Description
paths Array of objects Complete information of the direction
points String Encoded polyline
instructions Array of objects Step by step instructions to the destination
ETA numeric Estimated Arrival Time  in minutes
ETA_text String Estimated Arrival Time  in minutes


Sample Api Response:

{

    “message”: “Successful”,

    “status”: 200,

    “data”: {

        “hints”: {

            “visited_nodes.average”: “14.0”,

            “visited_nodes.sum”: “14”

        },

        “paths”: [

            {

                “distance”: 498.562,

                “weight”: 36.56323,

                “time”: 36561,

                “transfers”: 0,

                “points_encoded”: true,

                “bbox”: [

                    76.797099,

                    30.730066,

                    76.800159,

                    30.733568

                ],

                “points”: “{}pzD}_wsMiCzBQS_PzN”,

                “instructions”: [

                    {

                        “distance”: 97,

                        “heading”: 321.91,

                        “sign”: 0,

                        “interval”: [

                            0,

                            1

                        ],

                        “text”: “Continue”,

                        “time”: “11sec”,

                        “street_name”: “”

                    },

                    {

                        “distance”: 13,

                        “sign”: 2,

                        “interval”: [

                            1,

                            2

                        ],

                        “text”: “Turn right”,

                        “time”: “1sec”,

                        “street_name”: “”

                    },

                    {

                        “distance”: 387,

                        “sign”: -2,

                        “interval”: [

                            2,

                            3

                        ],

                        “text”: “Turn left onto Madhya Marg”,

                        “time”: “23sec”,

                        “street_name”: “Madhya Marg”

                    },

                    {

                        “distance”: 0,

                        “sign”: 4,

                        “last_heading”: 321.3376498211709,

                        “interval”: [

                            3,

                            3

                        ],

                        “text”: “Arrive at destination”,

                        “time”: “0sec”,

                        “street_name”: “”

                    }

                ],

                “legs”: [

                    {

                        “distance”: 497,

                        “time”: 35000

                    }

                ],

                “details”: {},

                “ascend”: 0,

                “descend”: 0,

                “snapped_waypoints”: “{}pzD}_wsM{TbR”,

                “minutes”: 1,

                “hours”: 0,

                “ETA”: 3,

                “ETA_text”: “36 seconds”

            }

        ]

    }

}

 

Link to the documentation:  https://docs.jungleworks.com/flightmap/map/direction-api

 

Leave A Comment?