This is the code I am using to draw the map
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var startlatlng = new google.maps.LatLng(50.067, -5.717);
var endlatlng = new google.maps.LatLng(58.633, -3.067);
var map;
function init() {
directionsDisplay = new google.maps.DirectionsRenderer();
var latlng = new google.maps.LatLng(54.6, -4.25);
var myOptions = { zoom: 6, center: latlng, disableDefaultUI: true,
mapTypeId: google.maps.MapTypeId.ROADMAP };
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
directionsDisplay.setMap(map);
calcRoute();
}
function calcRoute() {
var request = {
origin: startlatlng,
destination: endlatlng,
avoidHighways: true,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
google.maps.event.addDomListener(window, 'load', init);
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/axA4YZTIz5QJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.