Displaying recommended route
- Use a DOM object as placeholder to contain route details
map.Route.placeholder(document.getElementById('route'));
- Add a starting point using a marker object
map.Route.add(new longdo.Marker( { lon: 100.538316, lat: 13.764953 }, { title: 'Victory monument', detail: 'I\'m here' } ));
- lon,lat: latitude and longitude
- title: Message that will appear on the header of the popup
- detail: Message that will appear on the detail of the popup
- The step number 2 can be repeated to add more points
map.Route.add({ lon: 100, lat: 15 });
- search() for routing
map.Route.search();
Displaying routes based on user's choice
- Create placeholder element
map.Route.placeholder(document.getElementById('route'));
- Based on user's choice
map.Route.enableContextMenu(); map.Route.auto(true);
- enableContextMenu: if set to true,the destination menu will be shown on right mouse click
- auto: for enabling/disabling automatic route search
Other functions
- Don't use traffic infomation
map.Route.mode(longdo.RouteMode.Cost);
Example - Show travel time on the map line
map.Route.label(longdo.RouteLabel.Time);
Example - Don't take tollway
map.Route.enableRoute(longdo.RouteType.Tollway, false);
Example - Travel by motorcycle
map.Route.enableRestrict(longdo.RouteRestrict.Bike, true);
Example
More information: if you want the program to continue running after finished calculating the route, then you can use the event Guide Complete to archive it Example