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" }