ghettovoice / vuelayers

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

ol-mapbox-style compatibility issues - filterCache[layerId] is not a function #354

Closed peet86 closed 3 years ago

peet86 commented 3 years ago

Hi!

Thanks for this really cool lib, I really like it so far. I'm trying to use ol-mapbox-style in a new project but I ran into compatibility issues (eg. the ones somebody mentioned here: #298)

Then I've tried to use the versions you recommended:

    "ol": "^5.3.0",
    "ol-mapbox-style": "^4.3.0",
    "vuelayers": "0.11.22"

With the combination above I get this:

stylefunction.js:98 Uncaught TypeError: filterCache[layerId] is not a function
    at evaluateFilter (stylefunction.js:98)
    at styleFunction (stylefunction.js:269)
    at CanvasVectorTileLayerRenderer.render (VectorTileLayer.js:201)
    at loop (VectorTileLayer.js:226)
    at CanvasVectorTileLayerRenderer.createReplayGroup_ (VectorTileLayer.js:233)
    at CanvasVectorTileLayerRenderer.getTile (VectorTileLayer.js:117)
    at CanvasVectorTileLayerRenderer.prepareFrame (TileLayer.js:186)
    at CanvasVectorTileLayerRenderer.prepareFrame (VectorTileLayer.js:143)
    at CanvasMapRenderer.renderFrame (Map.js:157)
    at Map.renderFrame_ (PluggableMap.js:1226)
    at Map.<anonymous> (PluggableMap.js:189)

Do you have any idea how to resolve this issue or could you please recommend a working combo? With 0.11.27 I have the same issue..

I'm trying to integrate the simplest way:

    const map = this.$refs.map.$map
    fetch('https://x.com/style.json').then(response => {
      response.json().then(glStyle => {
        olms(map, glStyle)
      })
    })
ghettovoice commented 3 years ago

Hello @peet86 , I have found this issue https://github.com/openlayers/ol-mapbox-style/issues/261. To resolve try to forcefully install npm install @mapbox/mapbox-gl-style-spec@13.11.0. In my demo it works now. https://codesandbox.io/s/vuelayers-mapbox-styles-3zyl1?file=/src/App.vue

peet86 commented 3 years ago

@ghettovoice many thanks for the demo and the investigation. I dropped the vector layer approach for now and use raster tiles (because of other reasons).