Bing Maps: Module for v7 Adds Support for Long Routes



In the Bing Maps v7 control there is the Directions module which allows you to calculate a route with up to 15 waypoints and also generate a nice UI of the resulting directions. Before this module we would have to access the Bing Maps Routing REST service directly to calculate routes. For some this may be still may be the preferred method of requesting routes. The REST services allow you to calculate routes with up to 25 waypoints. In some situations support for routing between a larger number of waypoints may be required. This is where this module comes in. It wraps the Bing Maps Routing REST service and allows you to calculate a route with an unlimited number of waypoints. It accomplishes this by breaking the waypoints into batches and matching multiple routing requests. The results are then merged together into one route response.

This module is easy to use and has two public methods; GetRoute and IsProcessing. The GetRoute method takes in an array of waypoints, a Bing Maps key, a set of route options and a callback method. The IsProcessing method simply checks to see if the RouteServiceHelper class is processing a calculating a route.

This module, along with complete source code and an example implementation can be downloaded here. This module is part of the Bing Maps v7 Module community project on CodePlex, check this project out for other cool and useful Bing Maps v7 modules..

Below is an example of a route with 32 waypoints that was generated using this module.

Currently this module is limited to driving and walking directions, transit directions are not supported. User context information and route tolerances are also not supported. If this functionality is required outside of the Bing Maps V7 control the code in this module can easily be adopted to work on its own in other programming languages. This may be useful in cases where this functionality is needed in backend systems.

rbrundritt.wordpress.com

Leave a Reply