二级域名网站有哪些,贵阳专业做网站,创意广告,深圳总部企业名单首先需要引入openlayer api开发包。两种方式#xff1a;
1、import方式#xff0c;也就是npm安装#xff0c;npm install ol
2、外部js引入。
下载地址#xff1a;https://github.com/openlayers/openlayers
历史版本地址#xff1a;Releases openlayers/openlayers …首先需要引入openlayer api开发包。两种方式
1、import方式也就是npm安装npm install ol
2、外部js引入。
下载地址https://github.com/openlayers/openlayers
历史版本地址Releases · openlayers/openlayers · GitHub
里边有源码有打包的文件。
下载后直接放入本地项目在html文件引入即可 link href/static/openlayer/ol/ol.css relstylesheet /script typetext/javascript src/static/openlayer/ol/js/ol.js/script
3、引用cdn在线的,不推荐毕竟在线的受网络影像但是做做demo样例可以用 link relstylesheet hrefhttps://cdn.jsdelivr.net/npm/olv7.3.0/ol.css typetext/cssscript srchttps://cdn.jsdelivr.net/npm/olv7.3.0/dist/ol.js/script 在项目中使用接口
可以直接这样用ol.Mapol.layer
个人喜欢直接在上面直接这样定义const Map ol.Map; const View ol.View;就不用加那些类名属性了。当时npm导入的话直接就是import { Point } from ol/geom;
都要注意类名目录。具体可以看官网api
OpenLayers v7.5.1 API - IndexOpenLayers v7.5.1 API - IndexOpenLayers v7.5.1 API - Index
还有大牛翻译的中文版
OpenLayers v7.3.0 API - Index 地图示例
中文
OpenLayers Examples
英文
OpenLayers Examples