Skip to content
Last updated

You can get a route using the Routes API Compute Routes by sending an HTTP GET request to the route method (REST).

The following example shows the URL of a REST request to the route method:

https://dplace-api.themap.world/maps/api/directions/json?option=value&option=value

Include your request options in the query parameters.

Example: HTTP route request

The following code shows how to construct a route request. In this example, you set the source and destination locations and also specify:

  • origin is place ID, address, or textual latitude/longitude value
  • destination is place ID, address, or textual latitude/longitude value
  • waypoints is list of point along following leg
  • mode for drive mode: driving (default), motorcycling, bicycling or walking
  • alternatives is boolean or numeric
curl -X GET \
--header 'Content-Type: application/json' \
'https://dplace-api.themap.world/maps/api/directions/json?origin=21.02593%2C105.846535&destination=21.021002%2C105.85399&waypoints=21.023544%2C105.848985&alternatives=true&mode=driving&key=YOUR_API_KEY'

Example: HTTP route response body

{
    "geocoded_waypoints": [
        {
            "types": [
                "entertainment_and_recreation",
                "historical_landmark"
            ],
            "place_id": "4:venue:836a3e5047ce446d81cf9a70b4d888a2",
            "partial_match": false,
            "geocoder_status": "OK"
        },
        {
            "types": [
                "street_address"
            ],
            "place_id": "4:address:1534c20cbc5b427787c7f55987bba58f",
            "partial_match": false,
            "geocoder_status": "OK"
        },
        {
            "types": [
                "residential",
                "residential"
            ],
            "place_id": "4:venue:20e5f1be670843acacdb50ec7c23bed9",
            "partial_match": false,
            "geocoder_status": "OK"
        }
    ],
    "status": "OK",
    "routes": [
        {
            "overview_polyline": {
                "points": "ahibg@uoj{hEoA~CwCjOeCs@gCu@~Hw_@t@}DvDgVfAsIpAyFbDsOvAmHdAkF\\eBzT{fA~CgPrAmH~ItBtM`DdYvGvUvF|HhBzFtA|J`C\\Jxh@bN`GbBzD~@r\\fHzD~@nAwGhPk}@tBkKxBoKpAoFdAcEjRcaA^wBvIcc@xA}HgCa@k@IkRiCkIgAaLyA_[aEmV}CkGW|AqIhCkMhAyFlQo~@^iBx@gEpEhA|Ct@hOtDbm@fO"
            },
            "waypoint_order": [
                0,
                1,
                2
            ],
            "warnings": [],
            "summary": "Phố Quang Trung và Phố Ngô Quyền",
            "copyrights": "Digime Map Data",
            "legs": [
                {
                    "steps": [
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "ahibg@uoj{hEoA~CwCjO"
                            },
                            "maneuver": "depart",
                            "html_instruction": "Đi về hướng Tây bắc",
                            "start_location": {
                                "lng": 105.846539,
                                "lat": 21.025937
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.846539,
                                "lat": 21.025937
                            },
                            "duration": {
                                "value": 15.4,
                                "text": "16s"
                            },
                            "distance": {
                                "value": 37.9,
                                "text": "38 m"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "ioibg@izi{hEeCs@gCu@"
                            },
                            "maneuver": "turn-right",
                            "html_instruction": "Quẹo phải",
                            "start_location": {
                                "lng": 105.846197,
                                "lat": 21.026053
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.846197,
                                "lat": 21.026053
                            },
                            "duration": {
                                "value": 7.3,
                                "text": "8s"
                            },
                            "distance": {
                                "value": 15.9,
                                "text": "16 m"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "wwibg@s}i{hE~Hw_@t@}DvDgVfAsIpAyFbDsOvAmHdAkF\\eBzT{fA~CgPrAmH"
                            },
                            "maneuver": "turn-right",
                            "html_instruction": "Quẹo phải vào Phố Hai Bà Trưng",
                            "start_location": {
                                "lng": 105.84625,
                                "lat": 21.026188
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.847411,
                                "lat": 21.025873
                            },
                            "duration": {
                                "value": 41.2,
                                "text": "42s"
                            },
                            "distance": {
                                "value": 375.5,
                                "text": "0.4 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "_ygbg@eup{hE~ItBtM`DdYvGvUvF|HhBzFtA|J`C\\J"
                            },
                            "maneuver": "turn-right",
                            "html_instruction": "Quẹo phải vào Phố Quang Trung",
                            "start_location": {
                                "lng": 105.849699,
                                "lat": 21.025184
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.849199,
                                "lat": 21.023705
                            },
                            "duration": {
                                "value": 25.2,
                                "text": "26s"
                            },
                            "distance": {
                                "value": 195.8,
                                "text": "0.2 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "uodbg@oqo{hE"
                            },
                            "maneuver": "arrive-right",
                            "html_instruction": "Đến nơi ở bên phải",
                            "start_location": {
                                "lng": 105.849128,
                                "lat": 21.023499
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.849128,
                                "lat": 21.023499
                            },
                            "duration": {
                                "value": 0,
                                "text": "0s"
                            },
                            "distance": {
                                "value": 0,
                                "text": "0 m"
                            }
                        }
                    ],
                    "end_location": {
                        "lng": 105.849128,
                        "lat": 21.023499
                    },
                    "start_location": {
                        "lng": 105.846539,
                        "lat": 21.025937
                    },
                    "via_waypoint": [],
                    "departure_time": null,
                    "end_address": "Phố Quang Trung",
                    "start_address": "",
                    "arrival_time": null,
                    "duration_in_traffic": {
                        "text": "",
                        "value": 0
                    },
                    "duration": {
                        "value": 89.1,
                        "text": "1m29s"
                    },
                    "distance": {
                        "value": 625.1,
                        "text": "0.6 km"
                    }
                },
                {
                    "steps": [
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "uodbg@oqo{hExh@bN`GbBzD~@r\\fHzD~@"
                            },
                            "maneuver": "depart-right",
                            "html_instruction": "Đi về hướng Nam trên Phố Quang Trung",
                            "start_location": {
                                "lng": 105.849128,
                                "lat": 21.023499
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.848836,
                                "lat": 21.022701
                            },
                            "duration": {
                                "value": 27.2,
                                "text": "28s"
                            },
                            "distance": {
                                "value": 170,
                                "text": "0.2 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "mtabg@_rn{hEnAwGhPk}@tBkKxBoKpAoFdAcEjRcaA^wBvIcc@xA}H"
                            },
                            "maneuver": "turn-left",
                            "html_instruction": "Quẹo trái vào Phố Trần Hưng Đạo",
                            "start_location": {
                                "lng": 105.848624,
                                "lat": 21.022039
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.85028,
                                "lat": 21.021561
                            },
                            "duration": {
                                "value": 46.5,
                                "text": "47s"
                            },
                            "distance": {
                                "value": 393,
                                "text": "0.4 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "mr_bg@qsu{hEgCa@k@IkRiCkIgAaLyA_[aEmV}CkGW"
                            },
                            "maneuver": "turn-left",
                            "html_instruction": "Quẹo trái vào Phố Hàng Bài",
                            "start_location": {
                                "lng": 105.852233,
                                "lat": 21.020983
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.852502,
                                "lat": 21.022206
                            },
                            "duration": {
                                "value": 23.2,
                                "text": "24s"
                            },
                            "distance": {
                                "value": 195.5,
                                "text": "0.2 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "u~bbg@ajv{hE|AqIhCkMhAyFlQo~@^iBx@gE"
                            },
                            "maneuver": "turn-right",
                            "html_instruction": "Quẹo phải vào Phố Lý Thường Kiệt",
                            "start_location": {
                                "lng": 105.852593,
                                "lat": 21.022715
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.852593,
                                "lat": 21.022715
                            },
                            "duration": {
                                "value": 27.9,
                                "text": "28s"
                            },
                            "distance": {
                                "value": 184.3,
                                "text": "0.2 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "{_bbg@{sy{hEpEhA|Ct@hOtDbm@fO"
                            },
                            "maneuver": "turn-right",
                            "html_instruction": "Quẹo phải vào Phố Ngô Quyền",
                            "start_location": {
                                "lng": 105.854286,
                                "lat": 21.022222
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.854131,
                                "lat": 21.021777
                            },
                            "duration": {
                                "value": 17.7,
                                "text": "18s"
                            },
                            "distance": {
                                "value": 137.9,
                                "text": "0.1 km"
                            }
                        },
                        {
                            "driving_side": "right",
                            "transit_details": null,
                            "steps": null,
                            "polyline": {
                                "points": "}u_bg@}yx{hE"
                            },
                            "maneuver": "arrive-left",
                            "html_instruction": "Đến nơi ở bên trái",
                            "start_location": {
                                "lng": 105.853871,
                                "lat": 21.021039
                            },
                            "travel_mode": "DRIVING",
                            "end_location": {
                                "lng": 105.853871,
                                "lat": 21.021039
                            },
                            "duration": {
                                "value": 0,
                                "text": "0s"
                            },
                            "distance": {
                                "value": 0,
                                "text": "0 m"
                            }
                        }
                    ],
                    "end_location": {
                        "lng": 105.853871,
                        "lat": 21.021039
                    },
                    "start_location": {
                        "lng": 105.849128,
                        "lat": 21.023499
                    },
                    "via_waypoint": [],
                    "departure_time": null,
                    "end_address": "Phố Ngô Quyền",
                    "start_address": "Phố Quang Trung",
                    "arrival_time": null,
                    "duration_in_traffic": {
                        "text": "",
                        "value": 0
                    },
                    "duration": {
                        "value": 142.5,
                        "text": "2m22s"
                    },
                    "distance": {
                        "value": 1080.6,
                        "text": "1.1 km"
                    }
                }
            ],
            "bounds": {
                "southwest": {
                    "lng": 105.8559038,
                    "lat": 21.027229
                },
                "northeast": {
                    "lng": 105.8445792,
                    "lat": 21.019942
                }
            }
        }
    ]
}