I am displaying directions using the following code but when I try to
add a marker this doesn't display them.
It seems that the directions with the lines are displayed ok but
markers for additional points will not display. Has anyone come
across this before?
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var startLat = <c:out value="${customerBooking.startLattitude}"/>;
var startLong = <c:out value="${customerBooking.startLongtitude}"/
>;
var endLat = <c:out value="${customerBooking.endLattitude}"/>;
var endLong = <c:out value="${customerBooking.endLongtitude}"/>;
var start = startLat + ", " + startLong;
var end = endLat + ", " + endLong;
var latlng = new google.maps.LatLng(start);
directionsDisplay = new google.maps.DirectionsRenderer();
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);
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);
}
});
The marker is trying to be displayed by
var marker = new google.maps.Marker({
position: markerLatlng,
map: map,
title:"Additional marker"
});
I have even tried
marker.showMap(map);
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-api?hl=en.