openlayers加载地图、加载WMTS、包引用

(1)openlayers引入js、css方法:

官网的直接引入地址可能无效,可尝试引入以下地址的css、js:


(2)官方示例中import报错,解决办法:

参考:https://www.jianshu.com/p/62b992aa2232

采用webpack方式打开openlayers,示例项目地址:https://github.com/openlayers/ol-webpack

在main.js中编写功能,再重新yarn run build即可。

 

(3)打开WMTS的xml文件:

WMTS的xml文件可以通过openlayers、ArcGIS API for JavaScript打开。

openlayers打开WMTS的官方示例:

https://openlayers.org/en/latest/examples/wmts-layer-from-capabilities.html?q=wmts

https://openlayers.org/en/latest/examples/wmts.html?q=wmts

https://openlayers.org/en/latest/examples/?q=wmts

 

你可能感兴趣的:(openlayers,GIS)