简体   繁体   English

如何在Bing Maps V8 Javascript API中删除军械测量的选项?

[英]How to remove option for Ordnance Survey in Bing Maps V8 Javascript API?

I would like to remove the Ordnance Survey map type option in my Bing Maps v8 javascript map. 我想删除Bing Maps v8 JavaScript地图中的“军械测量”地图类型选项。

I'm looking through the interactive SDK, and there is an option to remove Streetside , so I'm hoping there is a way to disable the Ordnance Survey maps as well. 我正在浏览交互式SDK,并且有一个选项可以删除Streetside ,所以我希望也可以禁用Ordnance Survey地图。

Thanks for your help. 谢谢你的帮助。

This is the first time anyone has asked for this, however there is a fairly easy way to remove it from the dropdown list of options. 这是任何人第一次要求这样做,但是有一种相当简单的方法可以将其从选项的下拉列表中删除。 The map options has a property called supportedMapTypes which you can pass in an array of map types , and it will only display those as options in the dropdown. 地图选项具有一个称为supportedMapTypes的属性,您可以在地图类型数组中传递该属性,并且该属性仅在下拉列表中显示为选项。 Here is an example to limit it to road and aerial. 这是一个将其限制在道路和空中的示例。

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8" />
    <script type='text/javascript'>
    var map;

    function GetMap()
    {
        map = new Microsoft.Maps.Map('#myMap', {
            credentials: 'Your Bing Maps Key',
            supportedMapTypes: [
                Microsoft.Maps.MapTypeId.road,
                Microsoft.Maps.MapTypeId.aerial
            ]
        });
    }
    </script>
    <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script>
</head>
<body>
    <div id="myMap" style="position:relative;width:800px;height:600px;"></div>
</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM