Driving

Request

origins: Vancouver+BC|Seattle destinations: San+Francisco|Victoria+BC mode: driving key: API_KEY

URL

https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&key=YOUR_API_KEY
XML

Response

<?xml version="1.0" encoding="UTF-8"?> <DistanceMatrixResponse> <status>OK</status> <origin_address>Vancouver, BC, Canada</origin_address> <origin_address>Seattle, WA, USA</origin_address> <destination_address>San Francisco, CA, USA</destination_address> <destination_address>Victoria, BC, Canada</destination_address> <row> <element> <status>OK</status> <duration> <value>53778</value> <text>14 hours 56 mins</text> </duration> <distance> <value>1528699</value> <text>1,529 km</text> </distance> </element> <element> <status>OK</status> <duration> <value>11614</value> <text>3 hours 14 mins</text> </duration> <distance> <value>114513</value> <text>115 km</text> </distance> </element> </row> <row> <element> <status>OK</status> <duration> <value>44695</value> <text>12 hours 25 mins</text> </duration> <distance> <value>1299985</value> <text>1,300 km</text> </distance> </element> <element> <status>OK</status> <duration> <value>17285</value> <text>4 hours 48 mins</text> </duration> <distance> <value>296838</value> <text>297 km</text> </distance> </element> </row> </DistanceMatrixResponse>
JSON

Response

{ "destination_addresses" : [ "San Francisco, CA, USA", "Victoria, BC, Canada" ], "origin_addresses" : [ "Vancouver, BC, Canada", "Seattle, WA, USA" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "1,529 km", "value" : 1528699 }, "duration" : { "text" : "14 hours 56 mins", "value" : 53778 }, "status" : "OK" }, { "distance" : { "text" : "115 km", "value" : 114513 }, "duration" : { "text" : "3 hours 14 mins", "value" : 11614 }, "status" : "OK" } ] }, { "elements" : [ { "distance" : { "text" : "1,300 km", "value" : 1299985 }, "duration" : { "text" : "12 hours 25 mins", "value" : 44695 }, "status" : "OK" }, { "distance" : { "text" : "297 km", "value" : 296838 }, "duration" : { "text" : "4 hours 48 mins", "value" : 17285 }, "status" : "OK" } ] } ], "status" : "OK" }
Transit

Request

origins: Vancouver+BC|Seattle destinations: San+Francisco|Victoria+BC mode: transit transit_mode: train key: API_KEY

URL

https://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC|Seattle&destinations=San+Francisco|Victoria+BC&mode=transit&transit_mode=train&key=YOUR_API_KEY
XML

Response

<?xml version="1.0" encoding="UTF-8"?> <DistanceMatrixResponse> <status>OK</status> <origin_address>Vancouver, BC, Canada</origin_address> <origin_address>Seattle, WA, USA</origin_address> <destination_address>San Francisco, CA, USA</destination_address> <destination_address>Victoria, BC, Canada</destination_address> <row> <element> <status>OK</status> <duration> <value>145285</value> <text>1 day 16 hours</text> </duration> <distance> <value>1731459</value> <text>1,731 km</text> </distance> </element> <element> <status>OK</status> <duration> <value>71004</value> <text>19 hours 43 mins</text> </duration> <distance> <value>267181</value> <text>267 km</text> </distance> </element> </row> <row> <element> <status>OK</status> <duration> <value>87626</value> <text>1 day 0 hours</text> </duration> <distance> <value>1479935</value> <text>1,480 km</text> </distance> </element> <element> <status>OK</status> <duration> <value>53884</value> <text>14 hours 58 mins</text> </duration> <distance> <value>161703</value> <text>162 km</text> </distance> </element> </row> </DistanceMatrixResponse>
JSON

Response

{ "destination_addresses" : [ "San Francisco, CA, USA", "Victoria, BC, Canada" ], "origin_addresses" : [ "Vancouver, BC, Canada", "Seattle, WA, USA" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "1,731 km", "value" : 1731438 }, "duration" : { "text" : "1 day 16 hours", "value" : 145285 }, "status" : "OK" }, { "distance" : { "text" : "267 km", "value" : 267181 }, "duration" : { "text" : "19 hours 43 mins", "value" : 71004 }, "status" : "OK" } ] }, { "elements" : [ { "distance" : { "text" : "1,480 km", "value" : 1479935 }, "duration" : { "text" : "1 day 0 hours", "value" : 87626 }, "status" : "OK" }, { "distance" : { "text" : "162 km", "value" : 161703 }, "duration" : { "text" : "14 hours 58 mins", "value" : 53884 }, "status" : "OK" } ] } ], "status" : "OK" }
Travel Time

Request

origin: 75 9th Ave New York, NY destinations: Bridgewater Commons, Commons Way, Bridgewater, NJ|The Mall At Short Hills, Morris Turnpike, Short Hills, NJ|Monmouth Mall, Eatontown, NJ|Westfield Garden State Plaza, Garden State Plaza Boulevard, Paramus, NJ|Newport Centre Mall, Jersey City, NJ departure_time: 1541202457 traffic_model: best_guess mode: driving key: API_KEY

URL

https://maps.googleapis.com/maps/api/distancematrix/json?origins=75+9th+Ave+New+York,+NY&destinations=Bridgewater+Commons,+Commons+Way,+Bridgewater,+NJ|The+Mall+At+Short+Hills,+Morris+Turnpike,+Short+Hills,+NJ|Monmouth+Mall,+Eatontown,+NJ|Westfield+Garden+State+Plaza,+Garden+State+Plaza+Boulevard,+Paramus,+NJ|Newport+Centre+Mall,+Jersey+City,+NJ&departure_time=1541202457&traffic_model=best_guess&key=YOUR_API_KEY
XML

Response

<?xml version="1.0" encoding="UTF-8"?> <DistanceMatrixResponse> <status>OK</status> <origin_address>75 Ninth Ave, New York, NY 10011, USA</origin_address> <destination_address>Commons Way, Bridgewater, NJ 08807, USA</destination_address> <destination_address>Morris Turnpike, Short Hills, NJ 07078, USA</destination_address> <destination_address>Monmouth Mall, Eatontown, NJ 07724, USA</destination_address> <destination_address>Garden State Plaza Blvd, Paramus, NJ 07652, USA</destination_address> <destination_address>Newport Centre Mall, Jersey City, NJ 07302, USA</destination_address> <row> <element> <status>OK</status> <duration> <value>3334</value> <text>56 mins</text> </duration> <distance> <value>68781</value> <text>68.8 km</text> </distance> <duration_in_traffic> <value>3687</value> <text>1 hour 1 min</text> </duration_in_traffic> </element> <element> <status>OK</status> <duration> <value>2138</value> <text>36 mins</text> </duration> <distance> <value>34806</value> <text>34.8 km</text> </distance> <duration_in_traffic> <value>2487</value> <text>41 mins</text> </duration_in_traffic> </element> <element> <status>OK</status> <duration> <value>3930</value> <text>1 hour 6 mins</text> </duration> <distance> <value>86322</value> <text>86.3 km</text> </distance> <duration_in_traffic> <value>4044</value> <text>1 hour 7 mins</text> </duration_in_traffic> </element> <element> <status>OK</status> <duration> <value>2009</value> <text>33 mins</text> </duration> <distance> <value>32278</value> <text>32.3 km</text> </distance> <duration_in_traffic> <value>2082</value> <text>35 mins</text> </duration_in_traffic> </element> <element> <status>OK</status> <duration> <value>1113</value> <text>19 mins</text> </duration> <distance> <value>6879</value> <text>6.9 km</text> </distance> <duration_in_traffic> <value>1444</value> <text>24 mins</text> </duration_in_traffic> </element> </row> </DistanceMatrixResponse>
JSON

Response

{ "destination_addresses" : [ "Commons Way, Bridgewater, NJ 08807, USA", "Morris Turnpike, Short Hills, NJ 07078, USA", "Monmouth Mall, Eatontown, NJ 07724, USA", "Garden State Plaza Blvd, Paramus, NJ 07652, USA", "Newport Centre Mall, Jersey City, NJ 07302, USA" ], "origin_addresses" : [ "75 Ninth Ave, New York, NY 10011, USA" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "68.8 km", "value" : 68781 }, "duration" : { "text" : "56 mins", "value" : 3334 }, "duration_in_traffic" : { "text" : "1 hour 1 min", "value" : 3687 }, "status" : "OK" }, { "distance" : { "text" : "34.8 km", "value" : 34806 }, "duration" : { "text" : "36 mins", "value" : 2138 }, "duration_in_traffic" : { "text" : "41 mins", "value" : 2487 }, "status" : "OK" }, { "distance" : { "text" : "86.3 km", "value" : 86322 }, "duration" : { "text" : "1 hour 6 mins", "value" : 3930 }, "duration_in_traffic" : { "text" : "1 hour 7 mins", "value" : 4044 }, "status" : "OK" }, { "distance" : { "text" : "32.3 km", "value" : 32278 }, "duration" : { "text" : "33 mins", "value" : 2009 }, "duration_in_traffic" : { "text" : "35 mins", "value" : 2082 }, "status" : "OK" }, { "distance" : { "text" : "6.9 km", "value" : 6879 }, "duration" : { "text" : "19 mins", "value" : 1113 }, "duration_in_traffic" : { "text" : "24 mins", "value" : 1444 }, "status" : "OK" } ] } ], "status" : "OK" }