Created
March 5, 2018 22:46
-
-
Save BenFausch/2e646f2545e926def9ec5fb3423ba1b4 to your computer and use it in GitHub Desktop.
Basic proximity/driving directions using the google maps api, returns JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var origin1 = new google.maps.LatLng(55.930385, -3.118425); | |
var origin2 = 'Greenwich, England'; | |
var destinationA = 'Stockholm, Sweden'; | |
var destinationB = new google.maps.LatLng(50.087692, 14.421150); | |
var service = new google.maps.DistanceMatrixService(); | |
service.getDistanceMatrix( | |
{ | |
origins: [origin1, origin2], | |
destinations: [destinationA, destinationB], | |
travelMode: 'DRIVING', | |
}, callback); | |
function callback(response, status) { | |
// See Parsing the Results for | |
// the basics of a callback function. | |
console.log(response) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment