OpenLayers持续学习(1)

(1)创建一幅基础地图

实例化一个map构造函数,基础配置有target, view, layer


image.png
(2)添加投影
image.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类后调用方法传参

image.png
(7)添加鹰眼控件
  • 添加控件需要在添加控件后再加载图层
  • 鹰眼控件需要指定投影

image.png
(8)
image.png
(9)widgets

通知组件,用于进行alert与loading

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容