(1)创建一幅基础地图
实例化一个map构造函数,基础配置有target, view, layer
![](https://img.haomeiwen.com/i3213965/ff369e1bf1cbec15.png)
(2)添加投影
![](https://img.haomeiwen.com/i3213965/375622a6f38ba0b8.png)
(3)overlay
Overlays are visible widgets. Unlike Controls, they are not in a fixed position on the screen, but are tied to a geographical coordinate, so panning the map will move an Overlay but not a Control
(4)ol.interaction
- ol.interaction.Snap
当绘制的时候鼠标进入到一个已经绘制好的点的一定容差范围,鼠标点会被吸附到那个已经绘制好的点的位置
(5)
说明控件的折叠
controls: ol.control.defaults({attributionOptions{collapsed:false}})
.extend([newol.supermap.control.Logo()])
false为显示
(6)添加控件的方式
- 初始化地图时通过配置对象添加
- 通过实例化map类后调用方法传参
![](https://img.haomeiwen.com/i3213965/01e3f84214b58c93.png)
(7)添加鹰眼控件
- 添加控件需要在添加控件后再加载图层
- 鹰眼控件需要指定投影
![](https://img.haomeiwen.com/i3213965/477e94da184eda87.png)
(8)
![](https://img.haomeiwen.com/i3213965/c351a42443527a2c.png)
(9)widgets
通知组件,用于进行alert与loading
网友评论