Dear creator's community
I need help with this api request, I checked on the support online and on the form but it’s very confusing for me because there are different type of supports between the old version and the new version,
I would like to get the api for the distance matrix between two area.
I've tryed to create this code but of course doesn't work
MapResponse = getUrl((("https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=" + input.Origin) + "&destinations=" + input.Destination) + "&key=A*****************************M");
Tot_KM = MapResponse.executeXPath("/distance/value()");
My goal is to get the distance between two area that my user insert, I would like that the result will be in a “Tot km” field.
I used a debug on user input.
I will attached here the json answer:
{
"status": "OK",
"origin_addresses": [ "Vancouver, BC, Canada", "Seattle, État de Washington, États-Unis" ],
"destination_addresses": [ "San Francisco, Californie, États-Unis", "Victoria, BC, Canada" ],
"rows": [ {
"elements": [ {
"status": "OK",
"duration": {
"value": 340110,
"text": "3 jours 22 heures"
},
"distance": {
"value": 1734542,
"text": "1 735 km"
}
}, {
"status": "OK",
"duration": {
"value": 24487,
"text": "6 heures 48 minutes"
},
"distance": {
"value": 129324,
"text": "129 km"
}
} ]
}, {
"elements": [ {
"status": "OK",
"duration": {
"value": 288834,
"text": "3 jours 8 heures"
},
"distance": {
"value": 1489604,
"text": "1 490 km"
}
}, {
"status": "OK",
"duration": {
"value": 14388,
"text": "4 heures 0 minutes"
},
"distance": {
"value": 135822,
"text": "136 km"
}
} ]
} ]
}