In the following code the markers display properly but the route does not. Anyone have any ideas?
<html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <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 latlng = new google.maps.LatLng(39.8333, -98.5833); var myOptions = { zoom: 5, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); setMarkers(map, nights); calcRoute1() } /** * Data for the markers consisting of a name, a LatLng and a zIndex for * the order in which these markers should display on top of each * other. */ var nights = [ ['Walker, MI', 42.9397, -85.7819, 1], ['Wytheville, VA', 36.9460, -80.9517, 2], ['Ridgeland, SC', 32.4786, -80.9721, 3], ['Nashville, TN', 36.2098, -86.7780, 4], ['Jackson, WI', 43.3292, -88.1966, 5], ['Brooklyn Center, MN', 45.0716, -93.3024, 6], ['Crystal Lake, IL', 42.2279, -88.2978, 7] ]; function setMarkers(map, locations) { // Add markers to the map // Marker sizes are expressed as a Size of X,Y // where the origin of the image (0,0) is located // in the top left of the image. // Origins, anchor positions and coordinates of the marker // increase in the X direction to the right and in // the Y direction down. for (var i = 0; i < locations.length; i++) { var night = locations[i]; var myLatLng = new google.maps.LatLng(night[1], night[2]); var marker = new google.maps.Marker( { position: myLatLng, map: map, title: night[0], zIndex: night[3] }); } } function calcRoute1() { var start = "4665 juleon dr sw, walker, mi"; var end = "4665 juleon dr sw, walker, mi"; var waypts = [ {location: "116 North Bauer Road, Wooster, OH 44691", stopover: false}, {location: "2594 East Lee Highway, Wytheville, VA 24382", stopover: true}, {location: "1815 Capital Blvd, Raleigh, NC 27604", stopover: false}, {location: "221 James Taylor Rd., Ridgeland, SC, 29936", stopover: true}, {location: "6970 Main Street, Woodstock, GA 30188", stopover: false}, {location: "2407 Brick Church Pike, Nashville, TN, 37207", stopover: true} ]; var request = { origin: start, destination: end, waypoints: waypts, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } } } </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:100%; height:100%"></div> </body> </html> Live page is at http://www.thanko.info/travels.htm
-- 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.
