都是网上搜的,亲自试过,记录一下

方法一:

webInstance.map.getView().on('propertychange',function(e){
        switch(e.key){
            case 'resolution':
            console.log(e.oldValue);
            break;
        }
    });

此方法,会触发多次事件,所以不合适。

【转】Openlayers比例尺改变事件

方法二:

webInstance.zoomend = function(evt){
        console.log('zoomend on resolution: ' + evt.map.getView().getResolution());    
          evt.map.once('moveend', function(evt) {
        webInstance.zoomend(evt);
     });
     }

    webInstance.map.getView().once('change:resolution',function(evt){
        webInstance.map.once('moveend',function(evt){
            webInstance.zoomend(evt);
        })
    });

【转】Openlayers比例尺改变事件

这个比较靠谱,比例尺发生改变,只有一次事件过来。

 

https://stackoverflow.com/questions/33700255/how-can-i-detect-a-zoom-end 

https://stackoverflow.com/questions/26734512/open-layers-3-zoom-map-event-handler

相关文章:

  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-02-26
  • 2022-01-29
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-10-21
  • 2021-05-07
相关资源
相似解决方案