Skip to content

Is it possible to calculate a Bing Maps Route in C#, and then pass it to a Map in Javascript using MvC?

I am developing a Web Based Navigation app using Bing Maps and ASP MvC, and I found as well as being able to create a route in the view using JavaScript, it is possible to create a route in the C# controller using the Bing Maps Rest Toolkit, and then pass it over.

However, I have been unable to find any information as to how to actually display the passed route on the map, as the directions module that the view uses to create JavaScript has no way to accept a pre-calculated route, and can only create new ones. I’m just wondering if it is indeed possible to create and show routes this way, and if not, why?

Answer

The directions manager in the Bing Maps JavaScript SDK does not support passing in a precalculated route. You will need to pass over all the route options and let the directions manager calculate the route.