首页 / 浏览问题 / WebGIS / 问题详情
iclient for openlayers重新渲染地图的方法是什么?
35EXP 2020年07月02日
iclient for openlayers重新渲染地图的方法是什么?

1个回答

您好,您指的是对地图里面的layer进行重新渲染是吗?

 var sour= new ol.source.TileSuperMapRest({
            url: url,
            wrapX: true
        })
    var layer = new ol.layer.Tile({
        source:sour,
        projection: 'EPSG:4326'
    });
    map.addLayer(layer);
       setInterval(() => {
              sour.refresh()//刷新layer数据来源,相对于刷新图层
          }, 1000);
3,352EXP 2020年07月02日
我想对整个地图刷新

map只是容器,map的更新是针对与map绑定的div的size而言,而非map里面的layer。如果您那边因为div的变化而让其layer显示拉虚,可以使用

map的方法

updateSize() inherited

PluggableMap.jsline 1327

Force a recalculation of the map viewport size. This should be called when third-party code changes the size of the map viewport.

...