Route

Flexible instructions to the destination

The Routing API will show you how to get where you’re going. With the Routing API, you can:

  • Provide precise instructions to a destination using various transport modes (e.g., car, public transit, bicycle).

  • To request directions, call four values: a start point, destination, and car type, and waypoint (optional).

See the API Key Issuance page for information on using keys.

Routing API

GET https://api.fatos.biz/nostra/api/route

​Example API Call: https://api.fatos.biz/nostra/api/route?key=YOUR_API_KEY&origin=13.729139,100.493947&destination=13.746328,100.512601&angle=-1&rpoption=3&unixtime=1604626833&gmtoffset=32400

Query Parameters

NameTypeDescription

startname

string

Starting place name

destname

string

Destination name

hipass

integer

0: None 1: Yes Default: 0

fueltype

integer

0: Gasoline 1: Diesel 2: LPG 3: CNG 4: Electric 5: BioDiesel

pattern

integer

Reflect pattern information 0: Ignore 1: Reflect pattern information Default: 0

gmtoffset

string

Timezone

unixtime

string

Time when requesting for RP

traffic

integer

Reflect traffic information 0: Ignore 1: Reflect traffic information Default: 0

carspeed

integer

0~255 Default: 0

reqtype

string

0: Initial RP request 1. Retry RP request on route deviation 2. User RP request 3. Periodic RP request 4. Request Route detail Default: 0

origin

string

Start point (lat, lng)

destination

string

End point (lat, lng)

key

string

Your API Key

via

number

Waypoint (lat, lng), In the case of multiple waypoints, list them in order in the query string.

cartype

integer

car type 101: 2 Axles, less than 16 persons 102: 2 Axles, less than 32 persons 103: 2 Axles, less than 33 persons 104: 3 Axles, between 10 to 20 Ton 105: 4 Axles or above (Over 20 Ton) 106: 2 Axles, less than 1000cc 111: Truck with dangerous load 112: Truck 113: Construction Machinery 114: Construction Vehicle 115: Trailer 116: Farm Vehicle 121: Bus 122: Taxi 123: Taxi without passenger 124: Cart 125: HOV 126: Emergency 127: Motorcycle 128: 3 Wheel Motorcycle 141: Bicycle 142: Tricycle 143: Pedestrian 144: Pet 145: WheelChair 146: Visually Impaired

rpoption

integer

Routing Plan Option Sum of each option value. 1: Recommended 1 2: Recommended 2 4: Highway Priority 8: General road Priority 16: Shortest Distance 32: Free road (in the shortest time) 64: Exclude Car-only 256: Free road (in the shortest distance) ex) rpoption 3 => Recommended 1 + Recommended 2

gpsangle

number

degrees (0~359)

{
  "routes": [
    {
      "rpoption": 1,
      "bounds": {
        "lefttop": {
          "lon": 127.006812,
          "lat": 36.081916
        },
        "rightbottom": {
          "lon": 128.36276,
          "lat": 37.560658
        }
      },
      "legs": [
        {
          "distance": {
            "text": "339.7 km",
            "value": 339760
          },
          "duration": {
            "text": "265 min",
            "value": 15909
          },
          "end_location": {
            "lon": 128.325439,
            "lat": 36.144195
          },
          "start_location": {
            "lon": 127.02298,
            "lat": 37.559692
          },
          "step": [
            {
              "distance": {
                "text": "0 m",
                "value": 0
              },
              "duration": {
                "text": "0 sec",
                "value": 0
              },
              "end_location": {
                "lon": 127.022793,
                "lat": 37.559661
              },
              "start_location": {
                "lon": 127.022793,
                "lat": 37.559661
              },
              "polyline": {
                "points": "{zfdFmchfW"
              },
              "instructions": "starting point",
              "roadcategory": 12,
              "maneuver": 49
            },
            {
              // steps omitted
            },
            {
              "distance": {
                "text": "0.1 km",
                "value": 116
              },
              "duration": {
                "text": "56 sec",
                "value": 56
              },
              "end_location": {
                "lon": 127.023163,
                "lat": 37.560658
              },
              "start_location": {
                "lon": 127.022793,
                "lat": 37.559661
              },
              "polyline": {
                "points": "{zfdFmchfWIEUS]YGEGCWA_BI"
              },
              "instructions": "Destination",
              "roadcategory": 12,
              "maneuver": 3
            }
          ],
          "via_waypoint": [
            {
              "location": {
                "lon": 127.123108,
                "lat": 36.123123
              },
              "step_index": 27
            }
          ]
        }
      ],
      "overview_polyline": {
        "points_count": 3986,
        "points": "{zfdFmchfW??IEUS]YGEGCWA_BI?wBtDCP@Z@lCJ`@C\\G`@ULMx@eARS...."
      }
    }
  ],
  "status": "OK"
}

Display of Directions Results

After you receive the requested results, you must decode the result into a geometry code. Call the Fatos.polyLine() function as the decoded result and display the result on the map.

Last updated