Using Line Drive Maps

MapPoint Web Service is deprecated and will be retired November 18, 2011. Please go to for information about upgrading to Bing Maps.

The LineDrive map style allows you to present routing information in a simplified, sketch-style map.

Overview of the LineDrive Map Style

A LineDrive map contains only the necessary information the user needs to follow the route—each turn, primary road names, exit numbers, and distances, for example. Unlike traditional maps, however, LineDrive maps are not drawn to scale. The following illustration shows a LineDrive map:


LineDrive maps are generated much like a traditional route maps—you create a Route object within specified waypoints, and then use this route information to render a map. However, there is one key difference in the way maps are returned from MapPoint Web Service. With a traditional route map, the map scale can be adjusted to show the entire route on a single map, but this cannot be done with LineDrive maps. Because the LineDrive map style must draw and label every turn in a specified route, it is possible that the map will not fit in the specified image size. Therefore, when using LineDrive maps, you must be sure to check for, and handle if necessary, multiple maps returned from the Web service.

The following illustration shows a traditional route map for a long route, and the LineDrive route maps for the same route:

Cc514631.LineDrive02(en-us,MSDN.10).gif Note For performance and security reasons, MapPoint Web Service limits the total number of road segments in any LineDrive call to 300. If you try to create a complex set of LineDrive maps with more than 300 road segments, you will receive a SOAP error.

Generating a LineDrive Map

To generate a LineDrive map (or series of LineDrive maps), follow these steps:

  1. Find the locations along the route that you want to map. At a minimum, you must find the location of the starting and ending waypoints.

    Address aStart = new Address();
    Address aEnd = new Address();
    FindOptions fo = new FindOptions();
    fo.ResultMask = FindResultMask.LatLongFlag;
    FindAddressSpecification spec = new FindAddressSpecification();
    //Get the LatLong for the Start address
    spec.InputAddress = aStart;
    FindResults fr = new FindResults();
    fr = finder.FindAddress(spec);
    LatLong llStart = new LatLong();
    llStart = fr.Results[0].FoundLocation.LatLong;
    //Now get the LatLong for the End address
    spec = new FindAddressSpecification();
    spec.InputAddress = aEnd;
    fr = finder.FindAddress(spec);
    LatLong llEnd = new LatLong();
    llEnd = fr.Results[0].FoundLocation.LatLong;
  2. Create a Route object that contains the route returned from the RouteServiceSoap.CalculateRoute or RouteServiceSoap.CalculateSimpleRoute method. Optionally, you can generate turn-by-turn directions by using the Itinerary property of the Route object.

    Location startLocation = new Location();
    Location endLocation = new Location();
    startLocation.LatLong = new LatLong();
    startLocation.LatLong = llStart;
    endLocation.LatLong = new LatLong();
    endLocation.LatLong = llEnd;
    LatLong[] myLocations = new LatLong[2] {llStart, llEnd};
    //Calculate the route
    Route myRoute = new Route();
    myRoute = router.CalculateSimpleRoute(myLocations, "MapPoint.NA",      SegmentPreference.Quickest);
  3. Create a LineDriveMapSpecification object, set the LineDriveMapOptions, and then call the GetLineDriveMap method to generate the map.

    ImageFormat format = new ImageFormat();
    LineDriveMapOptions ldmo = new LineDriveMapOptions();
    ldmo.Format = format;
    ldmo.FontSize = MapFontSize.Smallest;
    ldmo.ReturnType = MapReturnType.ReturnUrl;
    ldmo.PaletteType = PaletteType.Color;
    LineDriveMapSpecification spec = new LineDriveMapSpecification();
    spec.Options = ldmo;
    LineDriveMapImage[] mi = render.GetLineDriveMap(spec);
  4. GetLineDriveMap returns an array of LineDriveMapImage objects. Your code should check to see if more than one image is returned and display the multiple maps as needed. Otherwise, users will only see the first part of the route.

    for (int x=0; x<mi.Length; x++)
     //add your code here to handle drawing multiple maps
         RenderMap(mi[x].Url, x);