One of the new features of the Virtual Earth API is multipoint routing.  Now, you can specify multiple points on a route and get directions to/from them.  The new GetDirections call on the VEMap makes it easy to do this.

For example, here's a simple code sample which shows how to get driving directions from San Jose to San Francisco. The first parameter to the GetDirections call is an array of locations.  You can pass string names or latitude, longitude pairs of VELatLong objects.

var locations = new Array();
locations.push("San Jose, California");
locations.push("San Francisco, California");
map.GetDirections(locations);

For the complete code sample see:

Virtual Earth API Simple Route Example

Now, let's say on the way to San Francisco, you want to make a stop in Santa Clara and Palo Alto.  All you have to do is put those locations in the locations array in the order you want to visit them, and then pass them to GetDirections.

var locations = new Array();
locations.push("San Jose, California");
locations.push("Santa Clara, California");
locations.push("Palo Alto, California");
locations.push("San Francisco, California");
map.GetDirections(locations);

The route will then pass through the desired locations on the way to the destination.

For the complete code sample see:

Virtual Earth API Simple Multipoint Route Example

In a future post I will show more details on how to customize the route even more with the GetDirections call.