百度地图怎么实现只显示某一个城市的地图,周边的省市不显示 10
// 百度地图API功能
// 创建Map实例
map = new BMap.Map("map", {
enableMapClick: false
});
// 初始化地图,设置中心点坐标和地图级别
map.centerAndZoom(new BMap.Point(105.403119, 38.028658), 5);
//禁用地图拖拽
//map.disableDragging();
//开启鼠标滚轮缩放
map.enableScrollWheelZoom(true);
//禁用滚轮放大缩小
//map.disableScrollWheelZoom();
//设置地图允许的最小级别。取值不得小于地图类型所允许的最小级别
map.setMinZoom(5);
//设置地图允许的最大级别。取值不得大于地图类型所允许的最大级别
map.setMaxZoom(10);
//设置地图样式,样式包括地图底图颜色和地图要素是否展示两部分
map.setMapStyle({
styleJson: [
{
"featureType": "land",
"elementType": "all",
"stylers": {
//"color": "#F4F3EF",
"color": "#000000",
"hue": "#000000",
"lightness": 0,
"visibility": "on"
}
},
{
"featureType": "water",
"elementType": "all",
"stylers": {
"color": "#000000",
"hue": "#000000",
"lightness": 0,
"visibility": "on"
}
},
{
"featureType": "green",
"elementType": "all",
"stylers": {
"visibility": "off"
}
},
{
"featureType": "manmade",
"elementType": "all",
"stylers": {
"visibility": "off"
}
},
{
"featureType": "building",
"elementType": "all",
"stylers": {
"visibility": "off"
}
},
{
"featureType": "road",
"elementType": "all",
"stylers": {
"visibility": "off"
}
},
{
"featureType": "poilabel",
"elementType": "all",
"stylers": {
"visibility": "off"
}
},
{
"featureType": "administrative",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}
]
});