ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
682 stars 230 forks source link

Change to tileSize in 0.12 #536

Closed scadergit closed 11 months ago

scadergit commented 1 year ago

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?

ghettovoice commented 1 year ago

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

scadergit commented 1 year ago

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]
        })
      }
    }
ghettovoice commented 1 year ago

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.

github-actions[bot] commented 12 months ago

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.