Select to view content in your preferred language

VectorTileLayer does not fetch tile beyond zoom level 16

1115
2
Jump to solution
08-30-2019 05:49 AM
JeromeCauchon
Occasional Contributor

I'm using a VectorTileLayer with a vector tile service hosted in MapTiler. My tileset has been created for level 0 to 18. Unfortunaltly, when i'm zooming in over the level 16, the VectorTileLayer does not fetch tile. I tried with version 4.11 and 4.12. Here's a my source code: CodePen

Somebody have an idea how to make it work?

Thanks

0 Kudos
1 Solution

Accepted Solutions
JeromeCauchon
Occasional Contributor

By debugging the VectorTileLayer, i figured how to fix it.... When a VectorTileLayer is instantiated, it creates is own tileInfo. By default, the maximum zoom level is 16. If you want to override it, you have to add a maxzoom property in the source of your style JSON object.

var style = {
..
   "sources": {
      "07829d77-6e7c-4995-958c-b649a1ad336e": {
         "maxzoom": 24,
         "type": "vector",
         "tiles": ["https://api.maptiler.com/tiles/5dc6f056-32ca-4d32-95f1-7960e7dc7b09/{z}/{x}/{y}.pbf?key=DrAk6YxPY2rSlxgUxfpT"]
}
...
};

View solution in original post

0 Kudos
2 Replies
JeromeCauchon
Occasional Contributor

By debugging the VectorTileLayer, i figured how to fix it.... When a VectorTileLayer is instantiated, it creates is own tileInfo. By default, the maximum zoom level is 16. If you want to override it, you have to add a maxzoom property in the source of your style JSON object.

var style = {
..
   "sources": {
      "07829d77-6e7c-4995-958c-b649a1ad336e": {
         "maxzoom": 24,
         "type": "vector",
         "tiles": ["https://api.maptiler.com/tiles/5dc6f056-32ca-4d32-95f1-7960e7dc7b09/{z}/{x}/{y}.pbf?key=DrAk6YxPY2rSlxgUxfpT"]
}
...
};

0 Kudos
mikkokärkkäinen
Emerging Contributor

I bumped into this problem myself as well. I'm using the vector data from the National Land Survey of Finland. They only provide data up to zoom level 14.

Your workaround works, but the downside is that the VectorTileLayer is making requests for the tiles beyond the zoom level they actually offers. This results in a whole lot of 404 requests.

0 Kudos