openlayer3——地图初始化

openlayer3——地图初始化
初始化地图
1、引入文件
粘贴图片
项目频繁使用就在index.html文件里引入

2、新增一个带id的标签作为地图容器
粘贴图片

3、初始化
that.map = new ol.Map({
target: “attackSiteMap”,
layers: [that.untiled],
interactions: ol.interaction.defaults(),
view: new ol.View({
center: that.mapCenter,
projection: new ol.proj.Projection({
code: “EPSG:4326”,
units: “degrees”,
axisOrientation: “neu”
}),
maxZoom: 20,
minZoom: 10,
zoom: 12
})
});
4、运行结果
粘贴图片

猜你喜欢

转载自blog.csdn.net/weixin_42255789/article/details/122363722