I've been trying to get this to work for the last few hours, but, I'm
stuck.
I want it to get the route from A to B, and the write the duration to
the log.
Seems like the event doesn't fire nor does it give an error message.
Can anyone spot the bug?
------------------ Here's the code;
---------------------------------------
var map;
var directions;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById('map_canvas'));
map.setCenter(new GLatLng(37.44, -122.14), 13);
directions = new GDirections(map);
GEvent.addListener(directions, "load", function() { GLog.write
(directions.getDuration().html); });
GEvent.addListener(directions, "error", function() { GLog.write
('error : ' + directions.getStatus().code); });
showRoutes();
}
function showRoutes() {
var address1 = '1, flinders st, melbourne, victoria, aus';
var address2 = '100, flinders st, melbourne, victoria, aus';
directions = new GDirections(map, document.getElementById
('directionsDiv'));
directions.load('from: ' + address1 +' to: '+ address2,
{getPolyline: true, getSteps: true});
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---