If you are looking for a distance at a distance not the shortest distance, you can try to call the API service using a URL, for example:
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
As a result, JSON will look 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" }
The distance to the actual distance between two points.
You can find more information in the Google Distance Matrix API
rumburak
source share