I am looking to calculate and give the distance between two sets of Lat and Long for travel on Road.
I have had a look at the Google\'s Directions and Distance Matrix A
If You are looking for driving distance NOT shortest distance then You can try to call API service with URL like:
http://maps.googleapis.com/maps/api/distancematrix/json?origins=54.406505,18.67708&destinations=54.446251,18.570993&mode=driving&language=en-EN&sensor=false
This will result in JSON like this:
{
"destination_addresses" : [ "Powstańców Warszawy 8, Sopot, Polska" ],
"origin_addresses" : [ "majora Henryka Sucharskiego 69, Gdańsk, Polska" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "24,7 km",
"value" : 24653
},
"duration" : {
"text" : "34 min",
"value" : 2062
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
Result distance is actual road distance between two locations.
You can find more details in The Google Distance Matrix API