ghettovoice/vuelayers

Change to tileSize in 0.12

scadergit opened this issue · 4 comments

We updated to 0.12 and just realized tileSize is no longer a parameter when using vl-source-tile-wms. Is there a different way to specify the tileSize per WMS layer? Do I have to specify a tileGridFactory?

Hello @scadergit ,
yes, you can define basic XYZ tilegrid using a helper createXYZ from core ol/tilegrid package. Pretty like with native OpenLayers API.

Thanks, I got it working by stealing your resolutionsFromExtent class (which is a nicer version of the OpenLayers tile size demo), and using the TileGrid class within a computed property. Was the implementation within vuelayers too specific for the wms tile source?

    tileGridFactory () {
      const size = 512
      const projExtent = getProjection('EPSG:3857').getExtent()
      const resolutions = this.resolutionsFromExtent(projExtent, this.maxZoom, [size, size], 0)
      return () => {
        return new TileGrid({
          extent: [-13884991, 2870341, -7455066, 6338219],
          resolutions: resolutions,
          origin: getExtentTopRight(projExtent),
          tileSize: [size, size]
        })
      }
    }

Nice.

I'm not remember exactly how it was in previous vuelayers versions.
I'm just decide to stay compatible with OpenLayers native API.
Also accepting tilegrid through factory allows the client code reuse(cache instance) same tilegrid for multiple sources.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.