back | source
Displaying recommended route
  1. Use a DOM object as placeholder to contain route details
    map.Route.placeholder(document.getElementById('route'));
  2. 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
  3. The step number 2 can be repeated to add more points
    map.Route.add({ lon: 100, lat: 15 });
  4. search() for routing
    map.Route.search();

Displaying routes based on user's choice
  1. Create placeholder element
    map.Route.placeholder(document.getElementById('route'));
  2. 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
  1. Don't use traffic infomation
    map.Route.mode(longdo.RouteMode.Cost);
    Example
  2. Show travel time on the map line
    map.Route.label(longdo.RouteLabel.Time);
    Example
  3. Don't take tollway
    map.Route.enableRoute(longdo.RouteType.Tollway, false);
    Example
  4. Travel by motorcycle
    map.Route.enableRestrict(longdo.RouteRestrict.Bike, true);
    Example

  5. 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