MapboxDirection

FREE
By volodimir.kudriachenko
Updated 5 months ago
Mapping
5.9/10
Popularity Score
92ms
Latency
100%
Success Rate

MapboxDirection API Documentation

Get driving, walking, and cycling routes and directions.

View API Details
POSTgetOptimalCycling
POSTgetOptimalDriving
POSTgetOptimalDrivingTraffic
POSTgetOptimalWalking
POSTgetOptimalCycling

Performs Optical Character Recognition. It detects and extracts text within an image, with support for a broad range of languages, along with support for automatic language identification.

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
coordinatesLIST
REQUIREDMinimum 2 pairs of coordinates. Maximum 25 pairs.
accessTokenCREDENTIALS
REQUIREDThe api key obtained from Mapbox
Optional Parameters
stepsBOOLEAN
OPTIONALWhether to return steps and turn-by-turn instructions. Can be true or false. The default is false.
overviewSELECT
OPTIONALType of returned overview geometry. Can be full (the most detailed geometry available), simplified (a simplified version of the full geometry), or false (no overview geometry). The default is simplified
alternativesBOOLEAN
OPTIONALWhether to return alternative routes. Can be true or false (default)
bearingsSTRING
OPTIONALUsed to filter the road segment the waypoint will be placed on by direction and dictates the angle of approach. This option should always be used in conjunction with the radiuses parameter. The parameter takes two values per waypoint: the first is an angle clockwise from true north between 0 and 360. The second is the range of degrees the angle can deviate by. We recommend a value of 45° or 90° for the range, as bearing measurements tend to be inaccurate. This is useful for making sure we reroute vehicles on new routes that continue traveling in their current direction. A request that does this would provide bearing and radius values for the first waypoint and leave the remaining values empty. If provided, the list of bearings must be the same length as the list of waypoints, but you can skip a coordinate and show its position with the ; separator.
radiusesSTRING
OPTIONALMaximum distance in meters that each coordinate is allowed to move when snapped to a nearby road segment. There must be as many radiuses as there are coordinates in the request, each separated by ; . Values can be any number greater than 0 or they can be the string unlimited. If no routable road is found within the radius, a NoSegment error is returned.
geometriesSELECT
OPTIONALFormat of the returned geometry. Allowed values are: geojson, polyline (with precision 5), polyline6 (with precision 6). The default value is polyline .
continueStraightBOOLEAN
OPTIONALSets allowed direction of travel when departing intermediate waypoints. If true the route will continue in the same direction of travel. If false the route may continue in the opposite direction of travel. Defaults to true for getOptimalDriving/getOptimalDrivingTraffic and false for getOptimalCycling and getOptimalWalking.
annotationsSTRING
OPTIONALWhether or not to return additional metadata along the route. Can be one or all of 'duration' or 'distance', each separated by ','.
Code Snippet
unirest.post("https://MapboxDirectionvolodimir-kudriachenkoV1.p.rapidapi.com/getOptimalCycling")
.header("X-RapidAPI-Host", "MapboxDirectionvolodimir-kudriachenkoV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://MapboxDirectionvolodimir-kudriachenkoV1.p.rapidapi.com/getOptimalCycling
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://MapboxDirectionvolodimir-kudriachenkoV1.p.rapidapi.com/getOptimalCycling")
.header("X-RapidAPI-Host", "MapboxDirectionvolodimir-kudriachenkoV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication