On Aug 7, 7:55 pm, Shane <[email protected]> wrote:
> 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?
Is this a test?
Did you read the posting guidelines?
>
> ------------------ 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);
>
// create a GDirections object and add listeners to it...
> 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';
>
//Overwrite the existing GDirections object (with the listeners) with
a new one (without listeners)...
> directions = new GDirections(map, document.getElementById
> ('directionsDiv'));
> directions.load('from: ' + address1 +' to: '+ address2,
> {getPolyline: true, getSteps: true});
>
> }
>
>
>
> }- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---