Distance Matrix

Computes the duration of the fastest route between all pairs of supplied coordinates. Returns durations or distances or both between the coordinate pairs.

Note that the distances are not the shortest distance between two coordinates, but rather the distances of the fastest routes. Durations are in seconds and distances are in meters. The length of sources and destinations can be smaller or equal to number of input locations.

Url

Method: GET

https://maps.track-asia.com/distance-matrix/{VERSION}/{PROFILE}/{COORDINATES}

Example

  • Returns a 2x2 duration matrix
https://maps.track-asia.com/distance-matrix/v1/car/106.1234,10.1234;106.5678,10.5678?key=public_key
  • Returns a 3x3 distance matrix
https://maps.track-asia.com/distance-matrix/v1/moto/106.1234,10.1234;106.5678,10.5678;106.5778,10.5998?key=public_key
  • Returns a 1x3 duration matrix
https://maps.track-asia.com/distance-matrix/v1/car/106.1234,10.1234;106.5678,10.5678;106.5778,10.5998?sources=1&key=public_key
  • Returns a 2x3 duration matrix
https://maps.track-asia.com/distance-matrix/v1/car/106.1234,10.1234;106.5678,10.5678;106.5778,10.5998?sources=1;2&destinations=0;1;2&key=public_key
  • Returns a 3x2 duration and distance matrix
https://maps.track-asia.com/distance-matrix/v1/car/106.1234,10.1234;106.5678,10.5678;106.5778,10.5998?sources=0;1;2&destinations=1;2&annotations=distance,duration&key=public_key
KeyValuesDescriptionExample
VERSIONv1Versionv1
PROFILEcar, moto or walkMode of transportationmoto
COORDINATES{longitude},{latitude};{longitude},{latitude}String of coordinates format101.1234,10.1234;101.5678,10.5678
sources{index};{index}[;{index} ...] or all (default)Use location with given index as source0;2
destinations{index};{index}[;{index} ...] or all (default)Use location with given index as destination1;3;4
annotationsduration (default), distance, or duration,distanceReturn the requested table or tables in responsedistance,duration
fallback_speeddouble > 0If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration0.5
keyString (required)API keypublic_key