Hello Experts,
Im begginer in maps API. im trying to calculate
the route between two LatLongs, but this simplest code is not working,
it just shows the center at Shadman, not showing the Path and the
Start and End Markers.
please check this out and point the error in code. Waiting for ur
valueable responce:
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Directions Complex</
title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var shadman = new google.maps.LatLng(24.957716,67.058011);
var myOptions = {
zoom:15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: shadman
}
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
}
function calcRoute() {
var start = new google.maps.LatLng(24.957716,67.058011);
var end = new google.maps.LatLng(24.9576,67.0602570);
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
function startUp(){
initialize();
calcRoute();
}
</script>
</head>
<body style="margin:0px; padding:0px;" onload="startUp()">
<div>
<div><div id="map_canvas" style="float:left;width:70%; height:100%"></
div>
<div id="directionsPanel" style="float:right;width:30%;height 100%"></
div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
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.