openlayers添加和清除多边形矢量图

在初始化地图时保存source:

 

var source = new ol.source.Vector({wrapX: false});

然后在需要清除时运行如下代码:

 

source.clear();

成功清除矢量图层…..
 

 

 

 

 

 

 

 

 

;

 

 

 

 

 

;

转载自:https://blog.csdn.net/museions/article/details/78420184

You may also like...