Skip to content

Routing from point A to point B.

Endpoint

https://maps.track-asia.com/route/v1/{PROFILE}/{COORDINATES}.json

Parameters

Parameter Values Description Example
PROFILE car, moto, walk, truck (required) Mode of transportation car
COORDINATES {longitude},{latitude};{longitude},{latitude} (required) String of coordinates format 101.1234,10.1234;101.5678,10.5678
geometries polyline (default), polyline6 , geojson Returned route geometry format (influences overview and per step) polyline
steps true , false (default) Return route steps for each route leg true
overview simplified (default), full , false Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all. full
key String (required) API key (use your own key; public_key is limited and for testing only) public_key

Polyline tool

Example Code

This example demonstrates how to request data in JSON format:

https://maps.track-asia.com/route/v1/car/106.1234,10.1234;106.5678,10.5678.json?geometries=polyline&steps=true&overview=full&key=public_key

This example demonstrates how to request data in XML format:

https://maps.track-asia.com/route/v1/moto/106.1234,10.1234;106.5678,10.5678.json?geometries=polyline&overview=full&key=public_key
# JSON
curl -G "https://maps.track-asia.com/route/v1/car/101.1234,10.1234;101.5678,10.5678.json" \
--data-urlencode "geometries=polyline" \
--data-urlencode "key=public_key"

 # XML
curl -G "https://maps.track-asia.com/route/v1/car/101.1234,10.1234;101.5678,10.5678.xml" \
--data-urlencode "geometries=polyline" \
--data-urlencode "key=public_key"
 // JSON
const response = await fetch("https://maps.track-asia.com/route/v1/car/106.1234,10.1234;106.5678,10.5678.json?geometries=polyline&steps=true&overview=full&key=public_key")
const data = await response.json()
console.log(data)

// XML
const response = await fetch("https://maps.track-asia.com/route/v1/moto/106.1234,10.1234;106.5678,10.5678.json?geometries=polyline&overview=full&key=public_key")
const data = await response.text()
console.log(data)

Response

JSON Response

The response is a JSON object with the following structure:

  • code: Status of the request (e.g., "Ok").
  • routes: An array of route objects. Each route contains:
    • geometry: The route geometry as a GeoJSON LineString with an array of [longitude, latitude] coordinates.
    • legs: An array of leg objects, each representing a segment between waypoints. Each leg contains:
      • steps: An array of step objects, each with:
        • geometry: GeoJSON LineString for the step.
        • maneuver: Information about the maneuver (type, location, bearings).
        • mode: Mode of transportation (e.g., "driving").
        • driving_side: Driving side (e.g., "right").
        • name: Name of the street or segment.
        • intersections: Array of intersection objects with details about entry/exit points.
        • weight, duration, distance: Metrics for the step.
      • summary: Name/summary of the leg.
      • weight, duration, distance: Metrics for the leg.
    • weight_name: Name of the weight metric used.
    • weight, duration, distance: Metrics for the route.
  • waypoints: An array of waypoint objects, each with:
    • hint: Internal hint for the routing engine.
    • distance: Distance from the input coordinate to the snapped point.
    • name: Name of the snapped location.
    • location: [longitude, latitude] of the snapped point.

Next Steps