Reynan
Reynan

Reputation: 163

How to rotate pushpin image in bing map?

I am trying to rotate the pushpin image base on the degree for example "120" to show which direction it is going.

 var pushpin = new Microsoft.Maps.Pushpin(curlocation, {
                icon: '/images/Airplane_icon.png',
                anchor: new Microsoft.Maps.Point(20, 20),
                color: 'red'
            });

Upvotes: 0

Views: 513

Answers (1)

rbrundritt
rbrundritt

Reputation: 17954

It is possible to rotate a pushpin in Bing Maps but requires a bit of code to achieve. There is a code sample here: https://bingmapsv8samples.azurewebsites.net/#Pushpin_RotatedImage This approach would work fine for a few pushpins, but if you have a lot of pushpins that all have difference rotations, or the rotation of a pushpin is updated frequently, this solution likely wouldn't be the best option.

Another consideration is to take a look at Azure Maps which is another Microsoft mapping platform which does support rotating icons on the map. Here is a sample: https://azuremapscodesamples.azurewebsites.net/index.html?sample=Symbol%20Layer%20Options (click on the icon options tab and move the rotation slider). Azure Maps can handle dynamic rotation values on large data sets easily. Here are a couple of related examples: https://azuremapscodesamples.azurewebsites.net/index.html?sample=Animate%20a%20Symbol%20along%20a%20Path

https://azuremapscodesamples.azurewebsites.net/index.html?sample=Add%20Arrow%20along%20a%20Path

Upvotes: 1

Related Questions