I am displaying directions within a map and would also like to add an
additional marker onto the maps.  Currently the marker code doesn't
display anything on top of the original maps.

The code below show what I currently have, does anyone have any ideas?


<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head>
    <script type="text/javascript" src="http://maps.google.com/maps/
api/js?sensor=false"></script>
    <script type="text/javascript" src="http://www.google.com/jsapi?
key=ABCDEFG"></script>

</head>
<body>
           <div id="map_canvas"  class="map-wrapper" style="width:
350px; height: 300px">
                  </div>

<script type="text/javascript">

    var directionDisplay;
    var directionsService = new google.maps.DirectionsService();
    var startLat = 52.2757476;
    var startLong = -0.9215016;
    var endLat = 52.2788455;
    var endLong = -0.639253;
    var start = startLat + ", " + startLong;
    var end = endLat + ", " + endLong;


        var latlng = new google.maps.LatLng(start);

        var settings = {
            zoom: 15,
            center: latlng,
            mapTypeControl: true,
            mapTypeControlOptions: {style:
google.maps.MapTypeControlStyle.DROPDOWN_MENU},
            navigationControl: true,
            navigationControlOptions: {style:
google.maps.NavigationControlStyle.SMALL},
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new
google.maps.Map(document.getElementById("map_canvas"), settings);

       var driverLat = 52.252803;
       var driverLong = -0.786896;

        var driverLatlng = new google.maps.LatLng(driverLat + "," +
driverLong);

        var marker = new google.maps.Marker({
            position: driverLatlng,
            map: map,
            title:"Driver Location!"
        });

      directionsDisplay = new google.maps.DirectionsRenderer();
      directionsDisplay.setMap(map);


        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);
            }
        });

</script>
</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 google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to