首页 > 解决方案 > 如何在必应地图中旋转图钉图像?

问题描述

我正在尝试根据度数旋转图钉图像,例如“120”以显示它的方向。

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

标签: imagebing-mapspushpin

解决方案


可以在 Bing 地图中旋转图钉,但需要一些代码来实现。这里有一个代码示例:https ://bingmapsv8samples.azurewebsites.net/#Pushpin_RotatedImage这种方法适用于一些图钉,但如果你有很多图钉都有不同的旋转,或者图钉的旋转是经常更新,此解决方案可能不是最佳选择。

另一个考虑因素是看一下 Azure Maps,它是另一个支持在地图上旋转图标的 Microsoft 地图平台。这是一个示例:https ://azuremapscodesamples.azurewebsites.net/index.html?sample=Symbol%20Layer%20Options (单击图标选项选项卡并移动旋转滑块)。Azure Maps 可以轻松处理大型数据集的动态旋转值。以下是几个相关示例: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


推荐阅读