Hi,

I have set suppressMarkers and suppressInfoWIndow to true to not display the 
default markers and infoWindow of a route. Then I have added my custom 
markers and infoWindows, as usual, to the map as you can see in the code 
below. However, no markers show up on the map.

What do I miss? 
Thanks. 

function initYWPDirectionMap() {
    ywpDirectionsDisplay = new google.maps.DirectionsRenderer({
        draggable: false,
        suppressInfoWindow: true,
        suppressMarkers: true
    });
    var ywpDirOptions = {
        zoom: 5,
        center: new google.maps.LatLng(65.00,-135.00),
        mapTypeId: google.maps.MapTypeId.HYBRID,
        mapTypeControl: true,
        streetViewControl: false,
        minZoom: 4
    };
    var start;
    
    if ( geoLocation && currentLatitude && currentLongitude ) {
        start = new google.maps.LatLng(currentLatitude, currentLongitude);
        
    }
    else {
        start = new google.maps.LatLng(60.7333, -135.094);
    }
    var end = new google.maps.LatLng(60.87116, -135.3384);
    var request = {
        origin:start,
        destination:end,
        travelMode: google.maps.TravelMode.DRIVING
    };
    ywpDirectionsService.route(request, function(result, status) {
        if (status == google.maps.DirectionsStatus.OK) {
            directionResult = result;
            ywpDirectionsDisplay.setDirections(result);
        }
        else {
            //TODO: handle exception
        }
    });
    // create custom markers
    var markerValues = [{iconUrl: 
'../resources/images/mapicons/youAreHere.png',
                         title: 'You are here, more or less!'},
                        {iconUrl: '../resources/images/mapicons/ywp.png',
                         title: 'Yukon Wildlife Preserve'}
                       ];
    for ( var i = 0; i < markerValues.length; i++ ) {
        var icon = new google.maps.MarkerImage(markerValues[i].iconUrl,
                    new google.maps.Size(32.0, 37.0),
                    new google.maps.Point(0, 0),
                    new google.maps.Point(16.0, 18.0));
        var shadow = new 
google.maps.MarkerImage('../resources/images/mapicons/shadow.png',
                    new google.maps.Size(51.0, 37.0),
                    new google.maps.Point(0, 0),
                    new google.maps.Point(16.0, 18.0));
        var marker = new google.maps.Marker({
            position: start,
            map: ywpDirectionsMap,
            icon: icon,
            shadow: shadow,
            title: markerValues[i].title
        });
        addDirectionsInfoWindow(marker);
    }
    ywpDirectionsMap = new 
google.maps.Map(document.getElementById('dir-gmap'), ywpDirOptions);
    ywpDirectionsDisplay.setMap(ywpDirectionsMap);

}

function addDirectionsInfoWindow(marker) {
    google.maps.event.addListener(marker, 'click', function() {
        directionsInfoWindow.setContent(marker.title);
        directionsInfoWindow.open(ywpDirectionsMap, marker);
    });
}


-- 
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/-/zgPn9k-1mB8J.
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.

Reply via email to