shortbread-tiles / shortbread-docs

Documentation of the Shortbread vector tile schema
https://shortbread-tiles.org
Creative Commons Zero v1.0 Universal
28 stars 6 forks source link

use of shortbread-tiles with OpenLayers #20

Closed vprint closed 8 months ago

vprint commented 10 months ago

I have an OpenLayers project which should run only on local.

I downloaded the experimental vector tile package over Niger from geofabrik (https://download.geofabrik.de/africa/niger-shortbread-1.0.tar.gz). and unzipped the file in /src/data/vectorTiles.

When i try to add the tiles in openLayers, i have the following error :

index.js:211 Uncaught Error: Unimplemented type: 3
  at Pbf.skip (index.js:211:20)
  at Pbf.readFields (index.js:46:45)
  at layersPBFReader (MVT.js:318:9)
  at Pbf.readFields (index.js:44:13)
  at MVT.readFeatures (MVT.js:260:27)
  at xhr2.onload (featureloader.js:107:20)

Here is my openLayers code :

  static createVectorTileLayer(layerParam: ILayerSettings): VectorTileLayer {
    return new VectorTileLayer({
      source: new VectorTileSource({
        format: new MVT({
          layers: ['streets'],
        }),
        url: layerParam.url,
        attributions: layerParam.attribution,
      }),
      properties: {
        name: layerParam.name,
      },
      zIndex: layerParam.zindex,
      visible: layerParam.visible,
    });
  }

for information my layerParam.url is 'src/data/vectorTiles/vector/{z}/{x}/{y}.pbf'.

Any idea on how to correct it ?