view = new ol.View({
center:ol.proj.transform([118.83569241210996, 31.768673346429903], ‘EPSG:4326’, ‘EPSG:3857’),
zoom:27,
maxZoom:30,
minZoom:27,
}),
map = new ol.Map({
target:’map’, //html页面中的id
controls:ol.control.defaults({
attribution:false,
zoom:false,
rotate:false
}).extend([new ol.supermap.control.Logo()]),
view:view, //位置
layers:_layers, //试图
overlays: [overlay] //弹框
});
添加控件:
map.addControl(new ol.control.ZoomSlider({})); //缩控件
添加图层要注意顺序,保证图层在需要的位置:
var _layers = [layer, vectorLayer, ]; //图层加载顺序有要求的,前面加载的在最下面