• Optimization
  • Navigation
  • Tracking
  • Maps
  • Places

Basic Distance Matrix Fast Request

Implement Using: Distance Matrix Fast API


Let’s create a simple Distance Matrix Fast request with 3 origins (O) and 3 destinations (D). We will get a 3 x 3 matrix with distance and duration values for all 9 combinations (or elements) of O x D pairs. We also set `mode=car’ to get distance and duration values for a route that a car can take

Request

1https://api.nextbillion.io/distancematrix/json?origins=34.05456317,-118.31528428|33.99167000,-118.25687955|34.00792776,-118.33063151&destinations=33.96763110,-118.23215346|33.93969502,-118.26583210|33.90184293,-118.19634326&mode=car&key=<your_api_key>

Response

1{
2 "status": "Ok",
3 "rows": [
4 {
5 "elements": [
6 {
7 "duration": {
8 "value": 1190
9 },
10 "distance": {
11 "value": 16195
12 }
13 },
14 {
15 "duration": {
16 "value": 1055
17 },
18 "distance": {

Have Questions ?