How to change tileSize in XYZ (tileLayer) from default([256,256]) to something else for openlayers?

722 Views Asked by At

I am trying to change the tile size for my TileLayer in openlayers and I have not been able to change it. No matter what I set the tileSize to be it is always [256,256]. Also, The files I am getting from local_url is 1900x1268. Below is the code.

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

There are 0 best solutions below