Google Distance Matrix On Localhost
I am trying to use google distance matrix to find out the distance and time from one source to one destination. I am calling the function $('#postCode').change(function () {
Solution 1:
Don't use the DistanceMatrix web service from javascript on the client, use the Google Maps Javascript API v3 DistanceMatrix Service.
$('#postCode').change(function () {
var address = "sydney";
var source = "melbourne"var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [address],
destinations: [source],
travelMode: 'DRIVING',
unitSystem: google.maps.UnitSystem.IMPERIAL,
}, callback);
functioncallback(response, status) {
// See Parsing the Results for// the basics of a callback function.
}
});
Post a Comment for "Google Distance Matrix On Localhost"