Tim Tim - 8 days ago 4
Javascript Question

Using Bing map api 7 how to animate a pushpin from one set of coordinates to another?

Using Bing maps api 7 and JavaScript I want to add a Pushpin to a map then have it move at a steady pace in a straight line to a new set of coordinates.

I want the Pushpin to be able to move to one place and then stop and wait for new coordinates. When it gets new coordinates from the rest service it will move to the new coordinates in the same way.

I have looked over the bing maps documentation trying to find an answer to my question with no success... I would prefer to do everything using the bing maps api and not have to add a third party library if possible. If it is not possible then I am open to third party library suggestions.

here is how I add a Pushpin

map.entities.push(new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(lat, lon), {
text: name,
visible: true,
textOffset: new Microsoft.Maps.Point(0, 5)
}));


Now that I have a Pushpin on my map how do I animate it to another set of coordinates. How?

Answer

This exact scenario has been documented in a blog post by the Bing Maps team here: https://blogs.bing.com/maps/2014/08/07/bring-your-maps-to-life-creating-animations-with-bing-maps-javascript/