Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function myFunction() {
- var frompoint = '横浜駅';
- var topoint = '東京スカイツリー';
- var kekkaDistance = distanceBetweenPoints(frompoint,topoint);
- Logger.log(kekkaDistance);
- }
- function distanceBetweenPoints(start_point, end_point) {
- // get the directions
- var directions = Maps.newDirectionFinder()
- .setOrigin(start_point)
- .setDestination(end_point)
- .setMode(Maps.DirectionFinder.Mode.DRIVING)
- .getDirections();
- // get the first route and return the distance
- var route = directions.routes[0];
- var distance = route.legs[0].distance.text;
- return distance;
- }
Add Comment
Please, Sign In to add comment