1. Home >
  2. Documentation >
  3. Services >
  4. getroute
 

getroute

This function allows to issue a google.maps.DirectionsRequest

Usage

Parameters

Note: options.origin and options.destination are converted into google.maps.LatLng

Example

This example get a route from an address and adds a directions renderer.

$("#test").gmap3({ 
  getroute:{
    options:{
        origin:"48 Pirrama Road, Pyrmont NSW",
        destination:"Bondi Beach, NSW",
        travelMode: google.maps.DirectionsTravelMode.DRIVING
    },
    callback: function(results){
      if (!results) return;
      $(this).gmap3({
        map:{
          options:{
            zoom: 13,  
            center: [-33.879, 151.235]
          }
        },
        directionsrenderer:{
          options:{
            directions:results
          } 
        }
      });
    }
  }
});
Close