My problem is very simple: with G_TRAVEL_MODE_DRIVING I use my custom
icons instead of classic green icons whith letter A - B.
If I use G_TRAVEL_MODE_WALKING, whit the same code, there are my
custom icons with the green icons A - B!
How can do for take off the green icons??
This is my code:
<script type="text/javascript">
function initialize()
{
var bounds = new GLatLngBounds();
map = new
google.maps.Map2(document.getElementById("map_canvas"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
var scale = new GScaleControl();
map.addControl(scale);
//Create new icon objects
baseStartIcon = new GIcon();
baseEndIcon = new GIcon();
//Set the images of the icons
baseStartIcon.image = "http://maps.google.com/mapfiles/ms/
micons/info.png";
baseEndIcon.image = "http://maps.google.com/mapfiles/ms/
micons/red-pushpin.png";
//Set the size of the image and the shadow (in pixels, this
should be the same size as the images you are using)
baseStartIcon.iconSize = new GSize(32, 32);
baseEndIcon.iconSize = new GSize(32, 32);
//Set the anchor point of the new icon (x,y)
baseStartIcon.iconAnchor = new GPoint(12, 30); // this would
be at the center of the icon
baseEndIcon.iconAnchor = new GPoint(10, 32); // this would be
at the center of the icon
//create a new GDirections object with no options
dir = new
GDirections(map,document.getElementById("itinerario"));
//add a load event to the GDirection object
GEvent.addListener(dir,"load", getdirection);
dir.loadFromWaypoints(["firenze","empoli"],
{getPolyline:true,travelMode:G_TRAVEL_MODE_WALKING});
function getdirection() {
//Get the poly line from the GDirections object
var poly=dir.getPolyline();
//moves the map to center the begining point in the user's
view
//and sets the zoom level
bounds.extend(poly.getVertex(0));
bounds.extend(poly.getVertex(poly.getVertexCount()-1));
//map.setZoom(map.getBoundsZoomLevel(bounds));
//map.setCenter(bounds.getCenter());
map.setCenter(bounds.getCenter(),map.getBoundsZoomLevel(bounds));//
poly.getVertex(0): is the first point of the polyline, the startpoint,
5: is the zoom level
//draw the polyline on the map
map.addOverlay(poly);
//Draw the custom icons
//one at the beginning
map.addOverlay(new
GMarker(poly.getVertex(0),baseStartIcon));
//and one at the end of the polyline
map.addOverlay(new
GMarker(poly.getVertex(poly.getVertexCount()-1),baseEndIcon));
}
}
</script>
--
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.