如何使openlayers(4)贴图在边缘溢出时不重绘?

时间:2018-04-09 08:53:04

标签: typescript openlayers

目前我的地图在溢出上重绘,如下所示:

enter image description here

显示的国家简单表示是普通的geojson多边形。

但是,无论你滚动多远,我都希望地图只显示一次。

我在视图extent中使用minResolution, maxResolution, min-/maxZoom进行了尝试,但似乎没有任何效果。

这是当前的视图实现(当然我尝试了不同的选项):

new View({
        center: proj.fromLonLat([6.131935, 49.611622]),
        zoom: 4,
        projection: 'EPSG:3857',
        minZoom: 0,
        maxZoom: 19,
        minResolution: 1024,
        maxResolution: 4096,
        extent: proj.get('EPSG:3857').getExtent()
    });

1 个答案:

答案 0 :(得分:1)

缩小时的数据复制使用wrapX属性控制在source级别。

使用显示GeoJson数据的OL example,可以使用:

var vectorSource = new ol.source.Vector({
  wrapX:false,
  features: (new ol.format.GeoJSON()).readFeatures(geojsonObject)
});