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
Key | Values | Description | Example |
---|---|---|---|
VERSION | v1 | Version | v1 |
PROFILE | car , moto or walk | Mode of transportation | moto |
COORDINATES | {longitude},{latitude};{longitude},{latitude} | String of coordinates format | 101.1234,10.1234;101.5678,10.5678 |
sources | {index};{index}[;{index} ...] or all (default) | Use location with given index as source | 0;2 |
destinations | {index};{index}[;{index} ...] or all (default) | Use location with given index as destination | 1;3;4 |
annotations | duration (default), distance , or duration,distance | Return the requested table or tables in response | distance,duration |
fallback_speed | double > 0 | If no route found between a source/destination pair, calculate the as-the-crow-flies distance, then use this speed to estimate duration | 0.5 |
key | String (required) | API key | public_key |