View Full Version : How to draw Polyline that matches road?

10-23-2012, 10:23 PM
I need to display multiple routes on a map. Since Mappoint only supports one route, I would like to draw a Polyline for each route so that it looks the same as an ActiveRoute would. For instance, something like this (found in TourSolver):


I can plot a normal polyline for the stops, but the lines are direct - they don't follow the roads.


Bob M..

10-24-2012, 08:47 AM
The short answer is you can't do it programmatically. Many have tried to do what you are attempting. The problem is you need the road definitions. If you dig deeper into the route API, you will find the directions also have valid Location objects. Unfortunately these are set to show the optimum view of the direction - there's no guarantee that they will even be on the route (although they often are).

TourSolver actually ships with its own road database - this is one of the reasons for the higher value subscription business model that they use. Having their own road database, allows them to implement their own route optimization engine, and the plot the routes as polylines. Really, TourSolve is only using MapPoint to display its results, and possibly to input the data (depending on the configuration).

10-24-2012, 09:40 AM
The short answer is you can't do it programmatically.

Arrgh - I was afraid that was the answer. I think I looked through every related post, and kept seeing hints that it could be done but never found anything concrete.

I'm really thinking about moving to Google or Bing maps. The licensing has become much more realistic now which was the big hurdle before. I don't relish rewriting everything though!

Thanks again,

Bob M..

Eric Frost
10-24-2012, 04:12 PM
It's possible to get a bunch of point along the route like this --

It's not a perfect match for the roads, but should be close enough if you are zoomed out a bit.

This wouldn't exactly be trivial to implement, but should be do-able!


10-25-2012, 08:39 AM
Ah yes, the "Rest Stop" trick - I'd forgotten about that. I actually implemented that in the past for a user. The main restriction is that it will work for "find shortest" but probably not "find fastest". Also the driving times will be unusable. however it is perfectly usable for some applications.