Warning
Coming soon!
Routing from point A to point B.
Endpoint
https://sg-maps.track-asia.com/route/v2/directions/{outputFormat}
outputFormat
| outputFormat | Description |
|---|---|
json (recommended) | indicates output in JavaScript Object Notation (JSON) |
xml | indicates output in XML |
Parameters
| Parameter | Values | Description | Example |
|---|---|---|---|
mode | driving (default), motorcycling , walking | The transportation mode to use | driving |
origin | {latitude},{longitude} (recommended) or address string | Textual latitude/longitude value to which you wish to calculate directions, ensure that no space exists between the latitude and longitude values. If you pass an address Directions service will geocode the string and convert to latitude/longitude | 1.3761,103.68 |
destination | {latitude},{longitude} (recommended) or address string | Textual latitude/longitude value to which you wish to calculate directions, ensure that no space exists between the latitude and longitude values. If you pass an address Directions service will geocode the string and convert to latitude/longitude | 1.795,103.72 |
key | String (required) | API key | public_key |
Example Code
https://sg-maps.track-asia.com/route/v2/directions/json?origin=1.4761,103.682652&destination=1.5795,103.72&mode=driving&key=public_key
https://sg-maps.track-asia.com/route/v2/directions/xml?origin=1.4761,103.682652&destination=1.5795,103.72&mode=driving&key=public_key
Response
JSON Response
The response is a JSON object with the following structure:
routes: An array of route objects. Each route contains:summary: A summary of the route (e.g., main streets).bounds: An object withnortheastandsouthwestcoordinates for the route bounds.copyrights: Copyright information.legs: An array of leg objects, each with:distance: Object withtext(human-readable) andvalue(meters).duration: Object withtext(human-readable) andvalue(seconds).start_address,end_address: Addresses for the leg.start_location,end_location: Objects withlatandlng.steps: Array of step objects, each with:distance,duration: As above.start_location,end_location: As above.polyline: Encoded polyline for the step.html_instructions: Step instructions (HTML).travel_mode: Travel mode (e.g., "DRIVING").maneuver: Maneuver type (e.g., "turn-right").
overview_polyline: Encoded polyline for the full route.waypoint_order: Array indicating the order of waypoints.
status: Status string (e.g., "OK").geocoded_waypoints: Array of geocoded waypoint objects, each with:geocoder_status: Status for the geocoding.place_id: Place identifier.types: Array of place types.
XML Response
The XML response has a similar structure, with elements corresponding to the JSON fields above. However, note the following subtle differences:
- XML results are wrapped in a root
<DirectionsResponse>element. - JSON denotes entries with multiple elements by plural arrays (such as
stepsandlegs), while XML denotes these using multiple singular elements (such as<step>and<leg>). - JSON denotes waypoint order via the
waypoint_orderfield, while XML denotes these using individual<waypoint_index>elements. - Blank elements are indicated through empty arrays in JSON, but by the absence of any such element in XML. A response that generates no results will return an empty routes array in JSON, but no
<route>elements in XML, for example.
Polyline tool
Next steps
- Try API playground