如何将XYZ(tileLayer)中的tileSize从默认([256,256])更改为openlayers的其他内容?

时间:2019-07-17 09:02:58

标签: openlayers openlayers-3 openlayers-5 angular-openlayers gwt-openlayers

我正在尝试在openlayers中更改我的TileLayer的图块大小,但无法更改。无论我将tileSize设置为什么,它始终是[256,256]。另外,我从local_url获取的文件是1900x1268。下面是代码。

var projection = get('EPSG:4326');
local_url = 'assets/tile/{z}/{x}/{y}.png';

map = new Map({
  target: 'map',
  layers: [
    new TileLayer({
      source: new XYZ({
        url: this.local_url,
        projection: projection,
        wrapX: false,
        tileSize: [1024,1024]
      })
  ],
  view: new View({
    center: [0,0],
    zoom:0,
    minZoom: 0,
    maxZoom: 5,
    projection: projection
  })
});

0 个答案:

没有答案