如何使用bing maps API仅显示国家/地区地图并隐藏地图的其他部分

时间:2019-10-23 09:30:00

标签: angular typescript maps bing-maps

我是bing maps API的新手,并且有一个要求,我只想显示国家地图而不是世界地图。 这是我所做的

initMap() {
/*customMapStyle  */
var myStyle = {
  elements: {
    area: { fillColor: '#b6e591' },
    water: { fillColor: '#75cff0' },
    tollRoad: { fillColor: '#a964f4', strokeColor: '#a964f4' },
    arterialRoad: { fillColor: '#ffffff', strokeColor: '#d7dae7' },
    road: { fillColor: '#ffa35a', strokeColor: '#ff9c4f' },
    street: { fillColor: '#ffffff', strokeColor: '#ffffff' },
    transit: { fillColor: '#000000' }
  },
  settings: {
    landColor: '#efe9e1'
  }
};


const options: Microsoft.Maps.IMapLoadOptions = {
  credentials: "my bing key",
  center: new Microsoft.Maps.Location(51.5074, -4.080278),
  mapTypeId: Microsoft.Maps.MapTypeId.grayscale,
  backgroundColor: Microsoft.Maps.Color.fromHex('#00FF00'),
  showZoomButtons: true,
  showLocateMeButton: false,
  disableBirdseye: true,
  allowHidingLabelsOfRoad: false,
  showLogo: false,
  zoom: 6,
  navigationBarMode: Microsoft.Maps.NavigationBarMode.minified,
  //supportedMapTypes: [Microsoft.Maps.MapTypeId.road, Microsoft.Maps.MapTypeId.aerial, Microsoft.Maps.MapTypeId.grayscale, Microsoft.Maps.MapTypeId.canvasLight]

};

但是这显示了所有其他国家以及英国,我想要实现的是仅显示英国地图并隐藏maps API的所有其他部分,并且bing-maps API中是否有任何方法或控件将允许这样做。

任何帮助将不胜感激。 预先感谢

0 个答案:

没有答案