Google maps, not just the app, has this functionality.
You can use their JavaScript API
You can find examples and documentation at their api.
For directions you will need to use their directions service
To use directions in the Google Maps JavaScript API, create an object
of type DirectionsService
and call DirectionsService.route()
to
initiate a request to the Directions service, passing it a
DirectionsRequest
object literal containing the input terms and a
callback method to execute upon receipt of the response.
The DirectionsRequest
object literal contains the following fields:
{
origin: LatLng | String | google.maps.Place,
destination: LatLng | String | google.maps.Place,
travelMode: TravelMode,
transitOptions: TransitOptions,
drivingOptions: DrivingOptions,
unitSystem: UnitSystem,
waypoints[]: DirectionsWaypoint,
optimizeWaypoints: Boolean,
provideRouteAlternatives: Boolean,
avoidHighways: Boolean,
avoidTolls: Boolean,
region: String
}
Initiating a directions request to the DirectionsService
with the
route()
method requires passing a callback which executes upon
completion of the service request. This callback will return a
DirectionsResult
and a DirectionsStatus
code in the response.
The following example will make a directions request and display the response in the directionsPanel
div
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var chicago = new google.maps.LatLng(41.850033, -87.6500523);
var mapOptions = {
zoom:7,
center: chicago
}
map = new google.maps.Map(document.getElementById("map"), mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
}
function calcRoute() {
var start = document.getElementById("start").value;
var end = document.getElementById("end").value;
var request = {
origin:start,
destination:end,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
In the HTML body:
<div id="map" style="float:left;width:70%; height:100%"></div>
<div id="directionsPanel" style="float:right;width:30%;height 100%"></div>